A Python library for interacting with the Mercatorio browser based game
Project description
Pymerc
A Python library for interacting with the Mercatorio browser based game
Usage
You must first generate API credentials.
Once generated, you can instantiate a Client
instance using the credentials.
from pymerc.client import Client
# Create a new client
client = Client(os.environ["API_USER"], os.environ["API_TOKEN"])
# Interact with the various API endpoints
towns = await client.towns.all()
for town in towns:
print(town.name)
Testing
Since this library parses live API endpoints, mocking values makes little sense.
Instead, you must provide a .env
file with your API credentials:
API_USER="<USER>"
API_TOKEN="<TOKEN>"
The tests will utilize this to validate that all endpoints are parsing correctly:
pytest .
Additionally, you can create an instance of the client to test with using ipython
:
> ipython
In [1]: from shell import main
In [2]: await main()
In [3]: from shell import client
In [4]: # Use the client as needed
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
pymerc-0.3.0.tar.gz
(6.3 kB
view hashes)
Built Distribution
pymerc-0.3.0-py3-none-any.whl
(9.1 kB
view hashes)