Trackmania.io API for my own project?
Important -See below on how to set your user agent
Your User-Agent Must Have:
- Your Discord Username
- Your Project Name
Example:
NottCurious#4351 | TMIndiaBot
" | via py-tmio" is automatically appended to your user agent
How to set user agent.
from trackmania import Client
Client.USER_AGENT = "NottCurious#4351 | TMIndiaBot"
How to set Redis Server Settings
from trackmania import Client
Client.REDIS_HOST = "127.0.0.1" # 127.0.0.1 is default
Client.REDIS_PORT = 6379 # 6379 is default
Client.REDIS_DB = 0 # 0 is default
Client.REDIS_PASSWORD = "yadayadayada" # Defaults to None. Don't need to change this if your redis server does not have a password.
Docs
Docs can be found on readthedocs.org.
Installation
Note: Must have Python 3.10 or higher.
python3 -m pip install py-tmio # Linux
python -m pip install py-tmio # Windows
Caching
Caching is done using a redis server. The client defaults to 127.0.0.1:6379
.
Caching is not required but is highly recommended.
April Roadmap
By April 8th
-
Implement TMMap Class (or rename COTD Map class)
- Parameters
- environment
- exchange
- exchange_id
- file_name
- id
- leaderboard
- medal_times
- name
- storage_id
- thumbnail
- thumbnail_cached
- uid
- uploaded
- url
- Functions
- author
- leaderboard_get(position)
- submitter()
- Parameters
-
Implement Room Class
- Parameters
- id
- image_url
- is_cloud
- login
- max_players_count
- name
- player_count
- region
- script
- script_settings
- Functions
- club()
- maps()
- Parameters
-
Implement ClubActivity class
- Parameters
- external_id
- id
- is_password_protected
- is_public
- media
- name
- type
- Functions
- campaign()
- room()
- Parameters
-
Implement ClubMember class
-
Parameters
- is_admin
- is_creator
- is_vip
- join_date
- role
-
Functions
- member()
-
-
Implement Club Class
- Parameters
- background
- created_at
- decal
- description
- featured
- id
- logo
- member_count
- name
- popularity
- screens
- state
- tag
- vertical
- Functions
- creator()
- fetch_activities(page)
- fetch_members(page)
- Parameters
-
Implement Campaign class
- Parameters
- created_at
- id
- image
- is_official
- leaderboard_id
- map_count
- media
- name
- uploaded_at
- Functions
- club()
- leaderboard()
- map(index)
- maps()
- Parameters
-
Implement CampaignSearchResult class
- Parameters
- club_id
- date
- id
- map_count
- name
- Functions
- get_campaign()
- Parameters
-
Implement CampaignMedia class
- Parameters
- button_background
- button_foreground
- decal
- live_button_background
- live_button_foreground
- popup
- popup_background
- Parameters
-
Implement CampaignLeaderboard class
- Parameters 1.
- Functions
-
Implement the Campaign Manager class
- Functions
- current_season
- get(club_id, id)
- official_campaigns()
- popular_campaigns(page)
- search(query, page)
- Functions
By April 15th
- Implement MapManager class
- Functions
- get()
- Functions
Examples
Latest TOTD
from trackmania.managers import totd_manager
# In Async Function
latest_totd = await totd_manager.latest_totd()
print(latest_totd.map_name)
Pull Requests and Issues
If you have any suggestions, bugs, fixes or enhancements, please open a Pull Request or Issue
Discord
Contact me on Discord if you have any questions, NottCurious#4351