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.5.tar.gz
(5.8 kB
view details)
Built Distribution
File details
Details for the file pytoontown-0.0.5.tar.gz
.
File metadata
- Download URL: pytoontown-0.0.5.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 | 6eda83fa75b56298fde7b66f5364da14ec8372da85cb3ad7bd1b3eb288eb307b |
|
MD5 | df35c1a13144ea13fd37e0812c578671 |
|
BLAKE2b-256 | bc6882d38895121fb3505381dee5ad3f92ed278139ae4b000fc38cb39f772090 |
File details
Details for the file pytoontown-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pytoontown-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.5 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 | c6a60b20fe6a15360bd063f0620f938ecc23dfdee1a5ee214253825dc8429797 |
|
MD5 | a036a5bb9a6cdcd48fc45abf5f036cb6 |
|
BLAKE2b-256 | 5e1b57923f2b7f125bf5aecf67c2ae8e5fc22360af85aa69fd7bd39b2b2db45c |