Skip to main content

A Python library for interacting with the Torn API

Project description

TornAPI

TornAPI is a Python library for interacting with the Torn API. This library provides easy access to Torn's various API endpoints, including user, city, and faction endpoints. It supports rate limiting and allows users to set custom API keys.

  • Easy-to-use API client.
  • Rate limiting to avoid exceeding the API request limits.
  • Custom exceptions for error handling.
  • Comprehensive support for user selection endpoints.

Features

  • Access to multiple Torn API endpoints
  • Rate limiting to prevent exceeding API request limits
  • Customizable API key and rate limit settings
  • Optional user ID parameter for user-related endpoints
  • Exception handling for API errors
  • Deprecation warnings for deprecated functions

Installation

To install TornAPI, simply use pip:

pip install tornapi

Usage

Here's an example of how to use the TornAPI library:

from tornapi import TornAPI

# Initialize the API client
api = TornAPI('your-api-key', rate_limit=100)

# Fetch basic user data
user_data = api.user.basic()
print(user_data)

# Fetch user icons
icons_data = api.user.icons()
print(icons_data)

# Fetch your profile
profile_data = api.user.profile()
print(profile_data)

# Fetch another user's profile by user ID
profile_data = api.user.profile(user_id=123456)
print(profile_data)

# Fetch stock data
stock_data = api.torn.stocks()
print(stock_data)

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

tornapi-0.2.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

tornapi-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file tornapi-0.2.0.tar.gz.

File metadata

  • Download URL: tornapi-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for tornapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0e6a42eed8a261751c7d9beacd521d8438a4aa860e6d607557013edcbf7b7412
MD5 97f5e03a260017c7d42740ca257a1970
BLAKE2b-256 17ab26f0fd5e708e7594950deabaf6c9cc2ae4fb6f1a566ce6f74d623561645f

See more details on using hashes here.

File details

Details for the file tornapi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tornapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for tornapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f98fffbc5a7306f8836fd35fd97aa2254d2717d841c9fa7f6155af2a4b0d65b6
MD5 d4057c61ccef6c6f7999025bf7ad9cc2
BLAKE2b-256 885c74e9c6efef6f4012020ef7f9c53f6fcb25945a9edf33d8fe15569a4ea3f1

See more details on using hashes here.

Supported by

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