Welcome to API sailplay.ru

API sailplay.ru

Build Status Coverals https://pypip.in/d/sailplay/badge.png https://badge.fury.io/py/sailplay.png

User’s Guide

This part of the documentation will show you how to get started in using API sailplay.ru.

API Reference

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

Initialize API client

You should have pin, store_department_id and store_department_key from the service.

from sailplay import SailPlayClient

client = SailPlayClient(pin, store_department_id, store_department_key)

Additional params

client = SailPlayClient(
    pin, store_department_id, store_department_key,
    token="token-here", # Set token manually (default "")
    silence=True,       # Dont fail on API errors (default False)
    loglevel="debug",   # Set log level (default INFO)

Get API token


Not required. Client will get token automatically on API requests.

print client.token

Working with api

Sailplay have nice and easy syntax. Just have a look:

# Get events list  http://sailplay.ru/api/v2/events/list/

# Create a new user http://sailplay.ru/api/v2/users/add/?...
client.api.users.add(user_phone='...', first_name='...', last_name='...')

# Get info about user http://sailplay.ru/api/v2/users/info/?...

# Create purchase http://sailplay.ru/api/v2/purchases/new/?...

# You also could use getitem syntax for params
# Same as

# And etc. I hope you make decision how the client works :)

For now client chooses API version automaticaly.

Context manager

You could redefine the client settings in context:

with client.ctx(silence=True):
    # Errors will not be raised here
    client.api.users.add(user_phone='...', first_name='...', last_name='...')

Raw api request

You could make raw request to sailplay API:

client.request(method='GET', url='/users/info', data={...})

Have a nice codding!

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/sailplay/issues