ezsession
A small useful Python module to abstract away the common auth header methods used by different software vendors. The output is a requests session with the authentication headers built in.
pip install ezsession
Auth Types and Required Inputs
- oauth -
auth_uri,client_id,client_secret,audience - oauth_basic -
auth_uri,username,password - oauth_password -
auth_uri,username,password - basic -
username,password,auth_uri(optional) - bearer -
api_key - ApiToken -
api_key - dell -
auth_uri,client_id,client_secret
Examples
Example usage for getting a Datto RMM session:
from ezsession import get_session
def datto_rmm_session(api_key, api_secret, server):
base_uri = f"https://{server}-api.centrastage.net"
auth = {
"type": "oauth_basic",
"auth_uri": f"{base_uri}/auth/oauth/token",
"username": api_key,
"password": api_secret,
"server": server,
}
return get_session(auth), base_uri
Example to initialize a Datto RMM session then get account variables.
drmm_user = "Your Datto RMM API Key"
drmm_pass = "Your Datto RMM API Secret"
drmm_server = "merlot" # Change to your Datto RMM server.
session, base_uri = datto_rmm_auth(drmm_user, drmm_pass, drmm_server)
response = session.get(f"{base_uri}/api/v2/account/variables")
variables = response.json()["variables"]
Metadata
Release files for ezsession 0.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ezsession-0.0.16.tar.gz | 3.2 kB | Without provenance | Details for ezsession-0.0.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ezsession-0.0.16-py3-none-any.whl | Python 3 | none | any | Details for ezsession-0.0.16-py3-none-any.whl |
Total release size: 6.3 kB
Release files / ezsession-0.0.16.tar.gz
| Download URL | ezsession-0.0.16.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d4bbc4310ed8b5a5157fcbb375cfa3113dea0863f6987e31f26277c10df1fdf
|
|
BLAKE2b-256 checksum How to use checksums |
978a1a15ae467403e84f2b61285a61a7414f49549968601e5a7146982ad9ad84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / ezsession-0.0.16-py3-none-any.whl
| Download URL | ezsession-0.0.16-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5442bc4eb43270f8b8b5f34e7b02e708e2333b8929633f0d29412ccc133fde8
|
|
BLAKE2b-256 checksum How to use checksums |
2ed0228e54e58289a02fbfbe10558bf5712f61ddbef4d7eba93fdead7605c996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for ezsession 0.0.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.