Skip to content

v2.2.4

Latest
Compare
Choose a tag to compare
@sbarbett sbarbett released this 25 Feb 03:59

Housekeeping

  • modified file structure to be more aligned with best practices
  • deleted old obsolete setup.py file
  • fixed license section of README.md (Issue#26)
  • updated .gitignore with common Python template
  • made RestApiConnection class available in __init__.py
  • fixed license_files in pyproject.toml (it excepts a list, not a dictionary)
  • fixed version in about.py

New Feature(s)

Issue#28

  • added constructors to RestApiClient and RestApiConnection classes to support custom HTTP headers (custom_headers)

    from ultra_rest_client import RestApiClient
    client = RestApiClient('username', 'password', custom_headers={"foo":"bar", "user-agent":"hello"})
    zones = client.get_zones()

    Captured header output:

    {
        "Accept": "application/json",
        "Authorization": "Bearer redacted",
        "Content-Type": "application/json",
        "foo": "bar",
        "user-agent": "hello",
        "User-Agent": "udns-python-rest-client-2.2.3"
    }
  • added a public method to RestApiConnection which allows modification of headers after client has been instantiated

    client.rest_api_connection.set_custom_headers({"boo":"far","user-agent":"goodbye"})
    zones = client.get_zones()

    Captured header output:

    {
        "Accept": "application/json",
        "Authorization": "Bearer redacted",
        "Content-Type": "application/json",
        "foo": "bar",
        "boo": "far",
        "user-agent": "goodbye",
        "User-Agent": "udns-python-rest-client-2.2.3"
    }
  • attempting to set the following headers will raise a ValueError

    • Content-Type
    • Authorization
    • Accept
  • updated README.md with example