Async-TruckersMP
============================================
An asynchronous Python API wrapper for `TruckersMP`_.
.. warning::
This library is in alpha and bugs may still be present.
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:
.. code-block::
pip install async-truckersmp
.. code-block::
pip install git+https://github.com/SamNuttall/Async-TruckersMP.git
Quickstart
^^^^^^^^^^^^^
Let's write a script to print all the server names.
.. code-block:: python
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
---------------------
* `Documentation`_.
* `Github Repository`_.
* If you need further help, feel free to contact Sam#9210 on Discord or open a new issue.
Licence
------------------
Released under the `MIT License`_.
.. _TruckersMP: https://truckersmp.com/
.. _Documentation: https://async-truckersmp.readthedocs.io/
.. _Github Repository: https://github.com/SamNuttall/Async-TruckersMP
.. _MIT License: https://github.com/SamNuttall/Async-TruckersMP/blob/main/LICENSE
Raw data
{
"_id": null,
"home_page": "https://github.com/SamNuttall/Async-TruckersMP",
"name": "async-truckersmp",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "truckersmp",
"author": "Sam Nuttall",
"author_email": "dev@samln.dev",
"download_url": "https://files.pythonhosted.org/packages/7b/c8/b6a7b6811961857ce404749300221067471ef40da29ba63dbdbe831b23af/async-truckersmp-0.2.4.tar.gz",
"platform": null,
"description": "Async-TruckersMP\r\n============================================\r\n\r\nAn asynchronous Python API wrapper for `TruckersMP`_.\r\n\r\n.. warning::\r\n This library is in alpha and bugs may still be present.\r\n\r\nFeatures\r\n------------------\r\n\r\n* **Rate limiting** - Pre-emptive rate limiting so you'll never hit a 429.\r\n* **Caching** - Automatic caching of responses so you don't have to.\r\n* **Configurable** - Several configuration options on initialisation.\r\n* **Documented** - Full docs with examples included for reference.\r\n* **Data models** - API responses are parsed into objects (Python classes).\r\n\r\nUsage\r\n------------------\r\n\r\nInstall\r\n^^^^^^^^^^^^^\r\n\r\nInstall via pip using either of these methods:\r\n\r\n.. code-block::\r\n\r\n pip install async-truckersmp\r\n\r\n\r\n.. code-block::\r\n\r\n pip install git+https://github.com/SamNuttall/Async-TruckersMP.git\r\n\r\nQuickstart\r\n^^^^^^^^^^^^^\r\n\r\nLet's write a script to print all the server names.\r\n\r\n.. code-block:: python\r\n\r\n from truckersmp import TruckersMP # Import the library\r\n\r\n loop = asyncio.get_event_loop() # Get the asyncio event loop\r\n\r\n async def main():\r\n truckersmp = TruckersMP() # Initalise the TruckersMP class\r\n servers = await truckersmp.get_servers() # Call the get_servers method\r\n for server in servers: # Loop through each server\r\n print(server.name) # Get the name of the server and print it\r\n\r\n loop.run_until_complete(main()) # Run the main function\r\n\r\n\r\nResources & Support\r\n---------------------\r\n\r\n* `Documentation`_.\r\n* `Github Repository`_.\r\n* If you need further help, feel free to contact Sam#9210 on Discord or open a new issue.\r\n\r\nLicence\r\n------------------\r\nReleased under the `MIT License`_.\r\n\r\n.. _TruckersMP: https://truckersmp.com/\r\n.. _Documentation: https://async-truckersmp.readthedocs.io/\r\n.. _Github Repository: https://github.com/SamNuttall/Async-TruckersMP\r\n.. _MIT License: https://github.com/SamNuttall/Async-TruckersMP/blob/main/LICENSE\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An asynchronous Python API wrapper for TruckersMP.",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/SamNuttall/Async-TruckersMP"
},
"split_keywords": [
"truckersmp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7bc8b6a7b6811961857ce404749300221067471ef40da29ba63dbdbe831b23af",
"md5": "6b3e205af730ccef253dfeea9416db39",
"sha256": "e4344c6c7af70734e679d750fa1d23e64fea074c0d3c315da40b2bf7cf80a56d"
},
"downloads": -1,
"filename": "async-truckersmp-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "6b3e205af730ccef253dfeea9416db39",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16457,
"upload_time": "2024-02-28T17:34:38",
"upload_time_iso_8601": "2024-02-28T17:34:38.746696Z",
"url": "https://files.pythonhosted.org/packages/7b/c8/b6a7b6811961857ce404749300221067471ef40da29ba63dbdbe831b23af/async-truckersmp-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-28 17:34:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SamNuttall",
"github_project": "Async-TruckersMP",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "async-truckersmp"
}