Skip to main content

Client SDK for Revolt analytics

Project description

Revolt analytics sdk for Python 3.6+

Install

Revolt is registered in pypi so just use pip.

pip install revolt-sdk

Usage

To create Revolt client you have to provide:

  • tracking_id - Your unique client tracking ID

  • secret_key - Client authorization secret for your tracking ID

  • app_code - Your application name/identifier i.e. ‘com.company.myapp’

  • app_version - Your application version i.e. ‘1.12.4’

If you don’t have tracking_id or secret_key, please contact Revolt Team for assistance.

import revoltsdk

client = revoltsdk.Revolt(
    tracking_id='your_tracking_id',
    secret_key='your_secret_key',
    app_code='com.company.myapp',
    app_version='2.1.11',
)

You may also pass any of additional options:

  • app_instance_id - Unique application instance ID. It will be randomly generated each time if None provided. It should be reused for same device/application instance.

  • timezone - Timezone used to send events. Default is current timezone provided by system.

  • revolt_host - Host name of Revolt server

  • batch_size - Maximum size of event batches sent to server. Events will be sent automatically when queue reaches batch*size. Default is 20.

  • auto_flush_delay - Delay in miliseconds before automatically sending events batch if batch_size was not reached. Calling send_event will reset the timer. Auto flush will be disabled if you pass None instead. If auto flush is disabled events will be flushed only if queue reaches batch_size or manually. Default is 5 seconds (5000).

Revolt client has one public method called send*event used to send analytics events. Events will be queued and sent when flush occours. It might happen if queue size reaches batch_size, if you use auto flush and there was no new event for at least auto_flush_delay time or when explicitly call send_event with flush parameter set to True.

client.send_event('some.empty')  # sends event without additional data

client.send_event(type='some.info', data={'info': 'works in python'})  # sends event with given data

client.send_event(type='some.flushed', flush=True)  # sends event immediately flushing all pending events

Event type name has to have no more than 32 characters. It should use dots for separating domain, object, event (example: ui.activity.started), last element of name should be a verb expressing what happened e.g. signedIn, started, deleted etc. Type of event determines format of event data.

Data associated with event might be any json serializable object (including arrays and nested objects) or None.

Debug

If you wish to debug or examine what and when data is sent to Revolt you can enable debug logs. SDK uses default python logging system. It is required to run application in debug mode (without python optimization) to have access to logs. Logs are omitted in optimized run.

License

Copyright 2019 Miquido

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the 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

revolt-sdk-1.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

revolt_sdk-1.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file revolt-sdk-1.0.1.tar.gz.

File metadata

  • Download URL: revolt-sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for revolt-sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8eac441db08416cc8ea0718ac711459c08a5ce4a2b36c881f0f4618e3750edac
MD5 963531fae33e536df9583adfd6074f45
BLAKE2b-256 aefec830de16509f8b59e25c14bc161fe134325f025d3550b467ffd54a117145

See more details on using hashes here.

File details

Details for the file revolt_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: revolt_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for revolt_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68d8a95e774fa17abcb7b34b0d4ff20a6b5f372108388ee3c0e46d3dc0be4e4a
MD5 2a4b679a60d5ed42a2916e29839e3503
BLAKE2b-256 4478da0d3ab23e5b1a5b2d338dcb3458fd09e62790b5ecb4e725fe2955b7c577

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