Ably.io Python client library - REST interface. Supports Python 2.7-3.5.
Visit https://www.ably.io/documentation for a complete API reference and more examples.
pip install ably
git clone https://github.com/ably/ably-python.git
cd ably-python
python setup.py install
git submodule init
git submodule update
pip install -r requirements-test.txt
nosetests
All examples assume a client and/or channel has been created as follows:
from ably import AblyRest
client = AblyRest('api:key')
channel = client.channels.channel_name
channel.publish('event', 'message')
message_page = channel.history() # Returns a PaginatedResult
message_page.items # List with messages from this page
message_page.has_next() # => True, indicates there is another page
message_page.next().items # List with messages from the second page
members_page = channel.presence.get() # Returns a PaginatedResult
members_page.items
members_page.items[0].client_id # client_id of first member present
presence_page = channel.presence.history() # Returns a PaginatedResult
presence_page.items
presence_page.items[0].client_id # client_id of first member
token_details = client.auth.request_token()
token_details.token # => "xVLyHw.CLchevH3hF....MDh9ZC_Q"
new_client = AblyRest(token=token_details.token)
token_request = client.auth.create_token_request(
{
'id': 'id',
'client_id': None,
'capability': {'channel1': '"*"'},
'ttl': 60000,
}
)
stats = client.stats() # Returns a PaginatedResult
stats.items
client.time()
Please visit http://support.ably.io/ for access to our knowledgebase and to ask for any assistance.
You can also view the community reported Github issues.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Ensure you have added suitable tests and the test suite is passing(
nosetests
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Copyright (c) 2015 Ably Real-time Ltd, Licensed under the Apache License, Version 2.0. Refer to LICENSE for the license terms.