UNKNOWN
Project description
API sailplay.ru – Short description.
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 "") version="v2", # Set API version prefix (default "v2") 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 :)
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
Built Distribution
File details
Details for the file sailplay-0.1.0.tar.gz
.
File metadata
- Download URL: sailplay-0.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723dc38854054ae71e88a99875933b893940a3eea6c4fc29c9305c2a9bdee077 |
|
MD5 | b897ca021dea3f76bd1aa61ea06986c4 |
|
BLAKE2b-256 | 7dcee7444aed98a32fc90268a61f6d8d4753f15ba29bc57cc7e959e9a7f22bae |
File details
Details for the file sailplay-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: sailplay-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7693f009ed13238e184ae816b2ccb4e08982c687ef1bbf11eb69b98aa48d7a2d |
|
MD5 | 4ec730c14c4a2b6655f2a1f35c236770 |
|
BLAKE2b-256 | 77f04a7aa981023f6f2071c7ce31d6999d2b0c19c3fb6bc963d2c36364acee9d |