Skip to main content

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


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.8.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atriumsports_sdk-0.0.8-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file atriumsports_sdk-0.0.8.tar.gz.

File metadata

  • Download URL: atriumsports_sdk-0.0.8.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9

File hashes

Hashes for atriumsports_sdk-0.0.8.tar.gz
Algorithm Hash digest
SHA256 6fe05d596c22d71c52c1363f25b89b3cc779e9897b543a4ab1d067eecca50a2e
MD5 2046eabd5fa0cfc058fc62456825490f
BLAKE2b-256 f170be4b1b216f54008e344f1a67a1f17cde8d2e16a0a0f8dc85fcb72a696439

See more details on using hashes here.

File details

Details for the file atriumsports_sdk-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: atriumsports_sdk-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9

File hashes

Hashes for atriumsports_sdk-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 db5dbfd1996c0d8808f7159fc5e0fda7ed2d1913e37a822d73b57c43114429fc
MD5 565ca9ed7fb0f5c5d37c5ec5b6a45e35
BLAKE2b-256 b8dd8e3a3be1a12922ca328d11b9d09573920a964b8c52a6459f445c23c0a315

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page