Skip to main content

Fully async python wrapper for TruckersMP API

Project description

snapedit_1696958911490

TruckersMP

Fully async python wrapper for TruckersMP API

Installing

pip install TruckersMP

Features

  • Fully async methods
  • All methods return Pydantic model as result for easier interaction with data
  • Full exception handling

Usage

from TruckersMP import TruckersMPClient

async def main():

    client = TruckersMPClient()

    # Get info about player
    player = await client.get_player(1)
    print("Player info")
    print("Player name >>>", player.name)
    print("Player ID >>>", player.id)
    print("Player join date >>>", player.joinDate)
    print('Is player in staff >>>', player.permissions.isStaff)
    print('Is player banned >>>', player.banned)

    print("-----------------------------------")

    # Get info about VTC
    vtc = await client.get_vtc(1)
    print("VTC info")
    print("VTC name >>>", vtc.name)
    print("VTC ID >>>", vtc.id)
    print("VTC tag >>>", vtc.tag)
    print("VTC owner >>>", vtc.owner_username)
    print("VTC members >>>", vtc.members_count)

    # And more...

if __name__ == '__main__':
    import asyncio
    asyncio.run(main())

Docs

Go to https://truckersmp.com/developers/api for more information about API

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

TruckersMP-1.0.1.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file TruckersMP-1.0.1.tar.gz.

File metadata

  • Download URL: TruckersMP-1.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for TruckersMP-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b60b57f0e695488db19e6ec8807ea32e6af741769a8c0d1c6e80cd5e3a37022a
MD5 55d63f1ac59dfb041939fbd8e27709a5
BLAKE2b-256 905a9c50b7724ecda1afe2995dcb34b67f670aebc6862ca11da164249776c528

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