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.1.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.1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tigol-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 84effeed8208dbf2e45d3a8de14828fe16f855cbffbdfb3ef194244b9390f4e8
MD5 b73c80da30510788ddb8320e1fc2e72c
BLAKE2b-256 eea3bc7c367e9b73b7a02411d8b3e7c17d2f4196f69375e461d4ab8507235d97

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigol-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: tigol-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 562ee912e7789bbd38c43e605345f7802bfd020a78172298dba8768d7b0dec76
MD5 e0bd78f9a28061a35a7946291785233b
BLAKE2b-256 b912519d46981241e2aaa30aec6e544469f5f2f59d9695c73d7d4aeb989351f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tigol-1.0.1-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