A Python API wrapper for the Toontown Rewritten and Corporate Clash APIs
Project description
pytoontown
A Python API Wrapper for popular toontown games (Toontown Rewritten, Toontown: Corporate Clash). Get data on invasions, population, districts, news and more!
Features
The Toontown Rewritten API Features 3 Classes:
ToontownRewrittenInvasion
ToontownRewrittenPopulation
ToontownRewrittenSillyMeter
The Corporate Clash API features one class, CorporateClashAPI
, which contains information on districts and the latest corporate clash news.
Installing
python3 -m pip install --upgrade pytoontown
Documentation
Read the documentation here
Code Example
from pytoontown.toontownrewritten import *
from pytoontown.corporateclash import *
from time import sleep
invasion = ToontownRewrittenInvasion()
population = ToontownRewrittenPopulation()
sillymeter = ToontownRewrittenSillyMeter()
clash = CorporateClashAPI()
#Refreshes all of the API data
def refresh():
invasion.refresh()
population.refresh()
sillymeter.refresh()
clash.refresh()
#Print out all of the API Data
def print_data():
refresh()
#Retrieve the invasion data as an array.
#For more information on `as_array`, view the documentation.
print(f"TTR Invasions: {invasion.invasions(as_array=True)}")
#Total population in TTR
print(f"Total Population: {population.total_population}")
#Population by district in TTR, represented as a dictionary
print(f"Population by District: {population.population_by_district}")
#TTR Silly Meter State, which is either "Active", "Reward", or "Inactive"
print(f"Silly meter state: {sillymeter.state()}")
#TTR Silly meter rewards (the three silly teams available)
print(f"Silly Meter rewards: {sillymeter.rewards()}")
#Description of the Silly teams available
print(f"Silly meter reward descriptions: {sillymeter.reward_descriptions()}")
#Silly Team winner (if in reward state)
print(f"Silly meter winner: {sillymeter.winner()}")
#how many points each silly team has
print(f"Silly meter reward points: {sillymeter.reward_points()}"})
#Corporate clash district breakdown, represented by an array of district objects (dictionaries) (read documentation for more information)
print(f"Corporate clash districts: {clash.districts()}")
#Corporate clash news articles, represneted by an array of news articles (dictionaries) (read documentation for more information)
print(f"Corporate clash news: {clash.news()}")
#Print out the API data every 10 minutes
while(True):
print_data()
time.sleep(600)
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
pytoontown-0.0.4.tar.gz
(5.8 kB
view details)
Built Distribution
File details
Details for the file pytoontown-0.0.4.tar.gz
.
File metadata
- Download URL: pytoontown-0.0.4.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a91338c5981bcf1df5e844dbee0fb5d77b0d2e0587d01d6a5849daa86537f159 |
|
MD5 | 4b74789373f8c18121710ccf450ae7b7 |
|
BLAKE2b-256 | e93728a2c5c8fcfdca5a8d1ef0a61ffb0dc3024ab2248a749978014f4933efa2 |
File details
Details for the file pytoontown-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: pytoontown-0.0.4-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5033c26ce3db54c96e4aae9871affee4d6e520c865de3e46647687b1d2185aed |
|
MD5 | 69b8f58e5ea91f08594e396ddab7d8d1 |
|
BLAKE2b-256 | 80b5a812a221ef023df11504cd4bbeee641f6cde61b18d87963c33267716b911 |