Skip to main content

Async-TruckersMP

An asynchronous Python API wrapper for TruckersMP.

Features

  • Rate limiting - Pre-emptive rate limiting so you’ll never hit a 429.

  • Caching - Automatic caching of responses so you don’t have to.

  • Configurable - Several configuration options on initialisation.

  • Documented - Full docs with examples included for reference.

  • Data models - API responses are parsed into objects (Python classes).

Usage

Install

Install via pip using either of these methods:

pip install async-truckersmp
pip install git+https://github.com/SamNuttall/Async-TruckersMP.git

Quickstart

Let’s write a script to print all the server names.

from truckersmp import TruckersMP  # Import the library

loop = asyncio.get_event_loop()  # Get the asyncio event loop

async def main():
    truckersmp = TruckersMP()  # Initalise the TruckersMP class
    servers = await truckersmp.get_servers()  # Call the get_servers method
    for server in servers:  # Loop through each server
        print(server.name)  # Get the name of the server and print it

loop.run_until_complete(main())  # Run the main function

Resources & Support

Licence

Released under the MIT License.

Metadata

Release files for async-truckersmp 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-truckersmp 0.2.5
File Size Uploaded Provenance Actions
async-truckersmp-0.2.5.tar.gz 16.5 kB Without provenance Details for async-truckersmp-0.2.5.tar.gz

Release files / async-truckersmp-0.2.5.tar.gz

Download URL async-truckersmp-0.2.5.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
10bfd219477a6f84662a7bc29b2eb399f922fc833ec9a501e5e9f3342d12c995
BLAKE2b-256 checksum
How to use checksums
906b25d02fdc00a42d1bacfb890a5604b817e312836f390aee8763d0c63af919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

Security for async-truckersmp 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page