Skip to main content

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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tigol-1.0.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tigol-1.0.0-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file tigol-1.0.0.tar.gz.

File metadata

  • Download URL: tigol-1.0.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tigol-1.0.0.tar.gz
Algorithm Hash digest
SHA256 235e6d46f707684975a408f047411ad520925deceea7cd45ecc100a3f627926c
MD5 3f2c33966bda4a9b3dc599b4670643fa
BLAKE2b-256 c2c050f037ebbecc58d5c95e68cfc148f3d56fc459c05cc752c62f01d8f1b8ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigol-1.0.0.tar.gz:

Publisher: python-publish.yml on alessiodam/TIgol-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tigol-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tigol-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for tigol-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9226cc6b3664dc894d95b8be055825b52e48234a5ab01ffff1106c88bb26ec7
MD5 29d6b0d7df97de55780928e203834975
BLAKE2b-256 4cd42efaa14511626eaaf8b907ae54303e023f7219105ae3f24671c07b96e535

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigol-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on alessiodam/TIgol-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page