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.0.tar.gz (4.3 kB view hashes)

Uploaded Source

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