Skip to main content

API Client for sailplay.ru

Project description

Python client for API sailplay.ru

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

Docs are available at https://sailplay.readthedocs.org/. Pull requests with documentation enhancements and/or fixes are awesome and most welcome.

Requirements

  • python >= 2.6

Installation

sailplay could be installed using pip:

pip install sailplay

Usage

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

client.login()
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/
client.api.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/?...
client.api.users.info(user_phone='...')

# Create purchase http://sailplay.ru/api/v2/purchases/new/?...
client.api.purchases.new(**params)

# 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

Contributing

Development of starter happens at github: https://github.com/klen/sailplay

Contributors

  • klen (Kirill Klenov)

License

Licensed under a BSD license.

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

sailplay-0.1.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

sailplay-0.1.5-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sailplay-0.1.5.tar.gz.

File metadata

  • Download URL: sailplay-0.1.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sailplay-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f69a2be71207591c8f3edfb44ffec25e34675e44abaf8cc1c93798e148944258
MD5 b2add26082e325ffcc877dfa777e3b32
BLAKE2b-256 195912ca1d49575f6da3fc5622954a3c3d2e779c6c86530c25ecdc8f94d9c13a

See more details on using hashes here.

File details

Details for the file sailplay-0.1.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sailplay-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 de9fa45665bb25462958b983d66aeda946283d16e0d80e05f5a0cfe5bfd8f6ea
MD5 f68174cb73b58b5f4ef3d9902f0f3b1f
BLAKE2b-256 b7b062d26b9de0065d5e4fb3f1de6a64961c30a971eff2def8cac6f66eef3b31

See more details on using hashes here.

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