A package for communicating with TIgol.
Project description
TIgol API Wrapper (Python)
This repository provides a Python wrapper for the TIgol API.
Example
You can find an example usage here.
# Description: Example script to demonstrate how to use the TIgol API Client to get user information
# This expects a valid client ID and a valid client secret to be used for the API client
# When creating the application on TIgol, please ensure that the redirect URI is set to `https://example.com/authorized`
import sys
from src.tigol import TIgolApiClient, User
# Initialize the TIgol API Client
tigol_client = TIgolApiClient(
client_id="client_id",
client_secret="client_secret",
)
# Get authorization code from user
auth_url = tigol_client.get_authorization_url(redirect_uri="https://example.com/authorized", scopes=["user:read"])
auth_code_input = input(f"""
Please go to the following URL to authorize the application:
{auth_url}
After authorization, you will be redirected to a URL.
Please copy the code from the redirected URL (for example, copy `abc` from ?token=abc) and paste it here:
""")
auth_code = auth_code_input.strip()
token_obj = tigol_client.exchange_code_for_token(code=auth_code)
if "user:read" not in token_obj.scopes:
print("user:read scope wasn't accepted, can't continue.")
sys.exit(1)
user_obj: User = tigol_client.get_user(token_obj)
print(f"User Information: {user_obj}")
License
This project is licensed under the GNU AGPLv3 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
tigol-0.0.3.tar.gz
(28.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tigol-0.0.3-py3-none-any.whl
(30.7 kB
view details)
File details
Details for the file tigol-0.0.3.tar.gz.
File metadata
- Download URL: tigol-0.0.3.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ab3df2eb19f850aa3be986c4d8cc1dd9e95abade182f13400189ca2173a77c
|
|
| MD5 |
20e3c4347eb38b75321f39ae8a39afb9
|
|
| BLAKE2b-256 |
0ccba97ae80a790ebb1960a3585c9c22b64944b40c0c42088bfdb4d7dd4d7f48
|
File details
Details for the file tigol-0.0.3-py3-none-any.whl.
File metadata
- Download URL: tigol-0.0.3-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a311d5f92e106dd56a714d32e57650d9045887ecc962f3d3333be58869ac379f
|
|
| MD5 |
57d6f991da49767fd4a31906eeeaf4b1
|
|
| BLAKE2b-256 |
3faf6a7d62cb3af3e5b743477cfa05a0f6cc88eff24862800d1a7ebc1318381c
|