Huawei Cloud API async client for DNS. Link to Huawei Cloud documentation. Example of use:
from feihua.client import Client
access_key_id = "EXAMPLE_ACCESS_KEY_ID"
secret_access_key = "EXAMPLE_SECRET_ACCESS_KEY"
host = "dns.example.ru"
zone_id = "EXAMPLE_ID"
client = Client(access_key_id=access_key_id, secret_access_key=secret_access_key, host=host)
# return list recordsets in zone
data_response, code_status = await client.recordsets.list(zone_id=zone_id)
# return created recordset in zone
data = {
"name": "record.example.com.",
"type": "A",
"records": [
"10.200.200.116",
],
}
data_response, code_status = await client.recordsets.create_record(zone_id=zone_id, data=data)
# return updated recordset in zone
recordset_id = "example_id"
data_update = {
"records": [
"10.200.200.114",
],
}
data_response, code_status = await client.recordsets.update_record(zone_id=zone_id, recordset_id=recordset_id, data=data_update)
# return deleted recordset in zone
data_response, code_status = await client.recordsets.delete_record(zone_id=zone_id, recordset_id=recordset_id)
# return recordset in zone
query = {
"id": "67857858897556785456786545678456"
}
data_response, code_status = await client.recordsets.find_records(zone_id=zone_id, query=query)
Before install poetry set the default virtual environment as .venv
.
Cause it default path for poetry env
virtualenv .venv
Poetry is python package manager.
Poetry resolve dependencies and conflicts in package and make it fast.
Installation
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
source $HOME/.poetry/env
Basic usage
poetry lock
lock dependenciespoetry update
lock, update and install dependenciespoetry install
for install dependencies from pyproject.tomlpoetry install --no-dev
for install dependencies without devpoetry add <package>
for adding dependency with check on conflictspoetry remove <package>
for removepoetry self update
literally
If not set explicitly (default), poetry
will use the virtualenv from the .venv
directory when one is available. If set to false
, poetry
will ignore any existing .venv
directory.
Seems like bump version script
The tool use git tag for setting version to __verison__.py
and __init__.py
Poetry Dynamic Versioning need to be installed to system python environment cause Poetry
can't see himself from venv
.
Poetry Dynamic Versioning triggered by poetry build
and make package with replaced version vars.
pip install poetry-dynamic-versioning
# globally
How to bump the version of the library?
- Set git tag
git tag 0.1.0 -m "Initial project"
- Dump version
poetry-dynamic-versioning
- Create distribution archives
poetry build
- Push tag in project
git push --tags
- Load packege
poetry publish -r feihua
Pre-commit hooks apply rules from .pre-commit-config.yml
pre-commit install
activate hookspre-commit autoupdate
update hooks (if you know what you do)git commit -m "<message>" -n
where -n is for skip hooks (if you really know what you do)
Run tests
poetry run pytest tests