Skip to content

MarianaStrix/feihua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Feihua


What is it?

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)

VirtualEnv

Before install poetry set the default virtual environment as .venv.

Cause it default path for poetry env

  • virtualenv .venv

Poetry

Poetry Documentation

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 dependencies
  • poetry update lock, update and install dependencies
  • poetry install for install dependencies from pyproject.toml
  • poetry install --no-dev for install dependencies without dev
  • poetry add <package> for adding dependency with check on conflicts
  • poetry remove <package> for remove
  • poetry 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.

Poetry Dynamic Versioning

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?

  1. Set git tag git tag 0.1.0 -m "Initial project"
  2. Dump version poetry-dynamic-versioning
  3. Create distribution archives poetry build
  4. Push tag in project git push --tags
  5. Load packegepoetry publish -r feihua

Pre-commit

Pre-Commit Documentation

Pre-commit hooks apply rules from .pre-commit-config.yml

  • pre-commit install activate hooks
  • pre-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)

Tests

Run tests

  • poetry run pytest tests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages