summaryrefslogtreecommitdiffstats
path: root/Readme.md
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-11-20 01:17:41 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2024-11-20 01:17:41 -0500
commiteab0e07b2d9931aa35f243fd24c42c02a4ec8533 (patch)
tree767a0da67d0a1cd8ce30db0ad0c800e17380b4cf /Readme.md
parent6094eb734bfd2159d81ffea918ea5d31e1e61441 (diff)
parent3e3ebe586385a83b10c8f1d0b9ba9b67c8b56d2f (diff)
Update upstream source from tag 'upstream/2.0.0'
Update to upstream version '2.0.0' with Debian dir a538d4b69c2b9e7ec310387046aa40f0e2499b5f
Diffstat (limited to 'Readme.md')
-rw-r--r--Readme.md104
1 files changed, 85 insertions, 19 deletions
diff --git a/Readme.md b/Readme.md
index c0058df..adf0808 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,9 +1,9 @@
# pkb_client
-Unofficial client for the Porkbun API
+Python client for the Porkbun API
---
-[![PyPI](https://img.shields.io/pypi/v/pkb_client)](https://pypi.org/project/pkb-client/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pkb_client) [![Downloads](https://static.pepy.tech/personalized-badge/pkb-client?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Total%20Downloads)](https://pepy.tech/project/pkb-client) ![GitHub](https://img.shields.io/github/license/infinityofspace/pkb_client) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/infinityofspace/pkb_client/Publish%20release%20distribution%20to%20PyPI)
+[![PyPI](https://img.shields.io/pypi/v/pkb_client)](https://pypi.org/project/pkb-client/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pkb_client) [![Downloads](https://static.pepy.tech/personalized-badge/pkb-client?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Total%20Downloads)](https://pepy.tech/project/pkb-client) ![GitHub](https://img.shields.io/github/license/infinityofspace/pkb_client) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/infinityofspace/pkb_client/pypi-publish-release.yml)
---
### Table of Contents
@@ -13,19 +13,24 @@ Unofficial client for the Porkbun API
1. [With pip (recommend)](#with-pip-recommend)
2. [From source](#from-source)
3. [Usage](#usage)
-4. [Third party notices](#third-party-notices)
-5. [License](#license)
+4. [Notes](#notes)
+5. [Third party notices](#third-party-notices)
+6. [Development](#development)
+ 1. [Setup environment](#setup-environment)
+ 2. [Tests](#tests)
+ 3. [Documentation](#documentation)
+7. [License](#license)
---
### About
-*pkb_client* is an unofficial client for the [Porkbun](https://porkbun.com) API. It supports the v3 of the API. You can
-find the official documentation of the Porkbun API [here](https://porkbun.com/api/json/v3/documentation).
+*pkb_client* is a python client for the [Porkbun](https://porkbun.com) API. It supports the v3 of the API. You can
+find the official documentation of the Porkbun API [here](https://api.porkbun.com/api/json/v3/documentation).
### Installation
-This project only works with Python 3, make sure you have at least Python 3.6 installed.
+This project only works with Python 3, make sure you have at least Python 3.9 installed.
#### With pip (recommend)
@@ -46,14 +51,16 @@ pip3 install pkb_client -U
```commandline
git clone https://github.com/infinityofspace/pkb_client.git
cd pkb_client
-pip install .
+pip3 install .
```
### Usage
Each request must be made with the API key and secret. You can easily create them at Porkbun. Just follow
-the [official instructions](https://porkbun.com/api/json/v3/documentation#Authentication). Make sure that you explicitly
-activate the API usage for your domain at the end.
+the [official instructions](https://api.porkbun.com/api/json/v3/documentation#Authentication). Make sure that you explicitly
+activate the API usage for your domain at the end. There are two ways to use `pkb_client`. The first way is to use it as
+a Python module. See the [module documentation](https://infinityofspace.github.io/pkb_client) for more information. The
+second way is to use the module from the command line, see below for more information.
After installation *pkb_client* is available under the command `pkb-client`.
@@ -64,10 +71,11 @@ pkb-client -k <YOUR-API-KEY> -s <YOUR-API-SECRET> ping
```
If you don't want to specify the key and secret in the program call, because for example the command line calls are
-logged and you don't want to log the API access, then you can also omit both arguments and *pkb-client* asks for a user
-input.
+logged, and you don't want to log the API access, then you can also set the environment variables `PKB_API_KEY` and
+`PKB_API_SECRET`. If you not specify API key and secret in any way, *pkb-client* asks for a user input. The command line
+arguments of the API key and secret have the highest priority.
-You can see an overview of all usable API methods via the help:
+You can see an overview of all usable cli methods via the help:
```commandline
pkb-client -h
@@ -121,19 +129,77 @@ Remove all existing DNS records of the domain `example.com` and restore the DNS
pkb-client -k <YOUR-API-KEY> -s <YOUR-API-SECRET> dns-import example.com dns_recods.json clear
```
-*Note:* The import function uses the record ID to distinguish DNS records.
+*Note:* The `dns-import` function uses the record ID to distinguish DNS records.
+
+### Notes
+
+Currently, TTL smaller than `600` are ignored by the Porkbun API and the minimum value is `600`, although a minimum
+value of `300` is [supported](https://api.porkbun.com/api/json/v3/documentation) and allowed by the RFC standard. However,
+you can do TTL smaller than `600` via the web dashboard.
### Third party notices
All modules used by this project are listed below:
-| Name | License|
-|:---:|:---:|
-| [requests](https://github.com/psf/requests) | [Apache 2.0](https://raw.githubusercontent.com/psf/requests/master/LICENSE) |
-| [setuptools](https://github.com/pypa/setuptools) | [MIT](https://raw.githubusercontent.com/pypa/setuptools/main/LICENSE) |
+| Name | License |
+|:-----------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
+| [requests](https://github.com/psf/requests) | [Apache 2.0](https://raw.githubusercontent.com/psf/requests/master/LICENSE) |
+| [setuptools](https://github.com/pypa/setuptools) | [MIT](https://raw.githubusercontent.com/pypa/setuptools/main/LICENSE) |
+| [sphinx](https://github.com/sphinx-doc/sphinx) | [BSD 2 Clause](https://raw.githubusercontent.com/sphinx-doc/sphinx/refs/heads/master/LICENSE.rst) |
+| [dnspython](https://github.com/rthalley/dnspython) | [ISC](https://raw.githubusercontent.com/rthalley/dnspython/refs/heads/main/LICENSEc) |
+| [responses](https://github.com/getsentry/responses) | [Apache 2.0](https://raw.githubusercontent.com/getsentry/responses/refs/heads/master/LICENSE) |
+| [ruff](https://github.com/astral-sh/ruff) | [MIT](https://raw.githubusercontent.com/astral-sh/ruff/refs/heads/main/LICENSE) |
Furthermore, this readme file contains embeddings of [Shields.io](https://github.com/badges/shields)
-and [PePy](https://github.com/psincraian/pepy). The tests use [ipify](https://github.com/rdegges/ipify-api).
+and [PePy](https://github.com/psincraian/pepy) images.
+
+_This project is not associated with Porkbun LLC._
+
+### Development
+
+#### Setup environment
+
+First get the source code:
+
+```commandline
+git clone https://github.com/infinityofspace/pkb_client.git
+cd pkb_client
+```
+
+Now create a virtual environment, activate it and install all dependencies with the following commands:
+
+```commandline
+python3 -m venv venv
+source venv/bin/activate
+pip3 install -r requirements.txt
+```
+
+Now you can start developing.
+
+Feel free to contribute to this project by creating a pull request.
+Before you create a pull request, make sure that you code meets the following requirements (you can use the specified
+commands to check/fulfill the requirements):
+
+- check unit tests: `python -m unittest tests/*.py`
+- format the code: `ruff format`
+- check linting errors: `ruff check`
+
+#### Tests
+
+You can run the tests with the following command:
+
+```commandline
+python -m unittest tests/*.py
+```
+
+#### Documentation
+
+To build the documentation you can use the following commands:
+
+```commandline
+sphinx-apidoc -f -o docs/source pkb_client
+cd docs && make html
+```
### License