A compact auth client for UltraDNS
Project description
ultra_auth
A compact Python client for managing a connection with the UltraDNS API. For the "official," and much more ambitious client, go here.
Features
- Support for authenticating with username and password, or directly with a bearer token.
- Automatic token refreshing when the token expires.
- Built-in handling of various content types.
Installation
You can easily install ultra_auth
using pip
:
pip install ultra_auth
Once installed, you can use the ultra_auth module in your Python scripts:
from ultra_auth import UltraApi
client = UltraApi(args)
Usage
Authenticating using Username and Password
client = UltraApi(your_username, your_password)
Authenticating using Bearer Token
client = UltraApi(your_bearer_token, use_token=True)
Authenticating using Bearer Token and Refresh Token
client = UltraApi(your_bearer_token, your_refresh_token, True)
Making API Calls
# Make a GET request
response = client.get("/ultra/api/endpoint")
# Make a POST request
response = client.post("/ultra/api/endpoint", payload={"key": "value"})
# ... similarly for PUT, PATCH, DELETE
Response Handling
The client can return data in the form of dictionaries, strings, or bytes depending on the response content type.
For example:
- The zone export endpoint, when requesting more than one zone, will return a zip file
- The zone export endpoint, when requesting one zone, returns a plain text response
- Most endpoints return JSON
Note
Using a bearer token without a refresh token means the client state will expire in approximately 1 hour (assuming the token was just generated). Be warned.
Contribute
Contributions are always welcome! Please open a pull request with your changes, or open an issue if you encounter any problems or have suggestions.
License
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ultra_auth-0.1.tar.gz
.
File metadata
- Download URL: ultra_auth-0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16d4e36be1def022f5d6b9d6f8a21965c588808a0ec0e68a6bbb9be62572f93 |
|
MD5 | 617fd0660fa97ef722d85f11d2591d99 |
|
BLAKE2b-256 | 4b9f3ceb69e2214bd1a59c392ae90d85f6497ea5a4db2637d6b65439e931e40c |
File details
Details for the file ultra_auth-0.1-py3-none-any.whl
.
File metadata
- Download URL: ultra_auth-0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b93c6246ae9ff56b131f8ce757b086f89a3249c4c4e81ecb786db64d547c370f |
|
MD5 | 5d758f34e418c969d9f45cddb6c44f9a |
|
BLAKE2b-256 | 781f120b18c9dae117c229cb5a3e324d1054b37f7db9771302b5f19614aa02c7 |