You should have api_token, from the TC service.
from ticketscloud import TCClient
client = TCClient(api_token='your-token-here')
client = TCClient(
access_token='your-token-here',
api_root='http://ticketscloud.ru',
api_version='v1',
loglevel='info',
user_agent='TC-Client',
)
The client has nice and easy syntax. Just have a look:
# Get events list GET http://ticketscloud.ru/v1/resources/events
client.api.resources.events()
client.api.resources.events['event-id']()
# Get deals list with scheme GET http://ticketscloud.ru/v1/resources/deals
client.api.resources.deals(**{
'fields-schema': 'id,event{id},term{extra}', 'status': 'accepted'})
# Create a new order POST http://ticketscloud.ru/v1/resources/orders/
client.api.resources.orders.post(total=..., event=...)
# Update a order PATCH http://ticketscloud.ru/v1/resources/orders/<id>
client.api.resources.orders['id'].patch(status=)
# You could also use a 'getitem' syntax for resources
client.api.resources['custom-resource-name'](**params)
# Same there
client.api['resources']['custom-resource-name'](**params)
# And etc. I hope you make decision how the client works :)
You could temporary redefine the client settings in context:
with client.ctx(loglevel='DEBUG'):
# More logging here
client.api.resources.deals(**params)
You could make a raw request to TC API:
client.request(method='GET', url='v1/resources/events', data={...})
Have a nice codding!