Python module for integration to Atrium Sports APIs
Project description
Atrium Sports API SDK
Python module to make use of the Atrium Sports Datacore API
Datacore REST API
from atriumsports import AtriumSports
atrium = AtriumSports({
'sport': 'basketball',
'credential_id': 'XXXXX',
'credential_secret': 'YYYY',
'organizations': ['b1e34'],
})
datacore = atrium.client('datacore')
response = datacore.get('/o/b1a23/competitions', limit=500)
for data in response.data():
print(data)
Datacore Streaming API
from atriumsports import AtriumSports
atrium = AtriumSports({
'sport': 'basketball',
'credential_id': 'XXXXX',
'credential_secret': 'YYYY',
"environment": "sandpit",
})
stream_api = atrium.client('datacore-stream')
def on_connect_callback_function(client):
""" example callback when connected """
print("connected")
def on_read_callback_function(client, topic, message):
""" example callback when message read """
print("{}: {}".format(topic, message))
connected = stream_api.connect({
"fixture_id": 'f71dfdd6-51f1-11ea-8889-22953e2ee7e2', #fixture_id
"scopes": [ # Scopes
"write:stream_events",
"read:stream_events"
],
"on_read": on_read_callback_function,
"on_connect": on_connect_callback_function
})
if not connected:
print(stream_api.error())
else:
stream_api.publish(
"write:stream_events",
{
"type": "event",
"data": {
"eventClass": "sport",
"eventId": "c2404cc0-9f75-11e8-98d0-529269fb1459",
"entityId": "c24048a6-9f75-11e8-98d0-529269fb1459",
"personId": "c2405b2a-9f75-11e8-98d0-529269fb1459",
"eventType": "2pt",
"subType": "jumpshot",
"clock": "PT08:23",
"shotClock": "PT12.3",
"periodId": 2,
"success": True,
"timestamp": "2018-08-14T16:45:34.34",
"clientId": "c2408302-9f75-11e8-98d0-529269fb1459",
"clientType": "TestApi:1.1.2"
}
}
)
time.sleep(40)
stream_api.disconnect()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
atriumsports_sdk-0.0.9.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for atriumsports_sdk-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdfccc6b32d2b024a8273dd9004fbb088351a3b35ddf17282bd0f59d97654d2b |
|
MD5 | 5ca3dc65fa909be8954156d4f6d4acfa |
|
BLAKE2b-256 | adde6f595e8f82a2c3e92dfbecd06c40391db66cda629f3f88b322459738e6a1 |