AuthAPI
A Simple Python API for Authenticated Operations.
Quickstart:
Let's assume you want to interact with Google Ads API.
- Create
my_secret.jsonwith the following information:
{
"client_id": "",
"client_secret": "",
"authorize_url": "",
"access_token_url": "",
"scopes": []
}
- Create a
main.pyscript and paste the following content.
from authapi import AuthAPI, AuthData
class JsonSecret:
def __init__(self, path: str):
self.path = path
def pull(self) -> dict:
with open(self.path, "r") as f:
return json.load(f)
def push(self, payload: dict) -> None:
with open(self.path, "w") as f:
json.dump(payload, f)
app_secret = JsonSecret("my_secret.json")
app_token = JsonSecret("my_token.json")
auth_data = AuthData(**app_secret.pull())
app = AuthAPI(
name="Auth API: My Auth API",
auth_data=auth_data,
token_secret=app_token,
)
app.debug = True
@app.route("/run", methods=["GET", "POST"])
def run():
token = app.get_token()
# Do your stuff here
return "Done!"
if __name__ == "__main__":
app.run(ssl_context="adhoc")
- Run
python main.pyand visit https://127.0.0.1:5000/ to start the authentication process.
Metadata
Release files for authapi 0.1.15
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 |
|---|---|---|---|---|
| authapi-0.1.15.tar.gz | 5.5 kB | Without provenance | Details for authapi-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| authapi-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for authapi-0.1.15-py3-none-any.whl |
Total release size: 13.4 kB
Release files / authapi-0.1.15.tar.gz
| Download URL | authapi-0.1.15.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
656d8acc64e647e79ed56c5715095ead5b2c218831602b0ab9b6817cb028d38a
|
|
BLAKE2b-256 checksum How to use checksums |
06a54d094d07214b836cabbca2621e9bd0bda2f734b9458af9475f11ba6ca1eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure
|
Release files / authapi-0.1.15-py3-none-any.whl
| Download URL | authapi-0.1.15-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d96f6be7e569a900ec1d28c6b88e0ea76e1f8e6b66ecd8ed33d6ab812d8706fe
|
|
BLAKE2b-256 checksum How to use checksums |
718f7df665dbd9e2abcbd5217a0ae53d17e5161c99d6b792e53410fc93bf5c70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1022-azure
|
Security for authapi 0.1.15
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.