Skip to content
 
 

Latest commit

 

History

371 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RudderStack

RudderStack Python SDK

Ask DeepWiki

RudderStack’s Python SDK lets you track events from your Python application. Once enabled, the event requests hit the RudderStack servers. RudderStack then transforms and routes these events to your specified destination platforms.

More details on the Python SDK can be found in our documentation

Getting Started with Python SDK

Install rudder-sdk-python using pip:

pip install rudder-sdk-python

Initializing the RudderStack Client

import rudderstack.analytics as analytics

analytics.write_key = <SOURCE_WRITE_KEY>
analytics.on_error = <FAILURE CALLBACK>
analytics.debug = <True or False>
analytics.dataPlaneUrl = <RUDDERSTACK_DATA_PLANE_URL>

analytics.gzip = <True or False>

Sending Events

Once the RudderStack client is initialized, you can use it to send your customer events. A sample track call is shown below:

rudder_analytics.track('developer_user_id', 'Simple Track Event', {
  'key1': 'val1'
})
analytics.track('user_id', 'Simple Track Event', anonymous_id='anonymousId',
  properties={
  'key1': 'val1'
}, context={
  'key1': 'val1'
})

For more information on the supported calls, refer to the documentation.

Proxy configuration

Pass proxies when you create a Client. A Requests-style mapping is preferred:

from rudderstack.analytics.client import Client

client = Client(
    'SOURCE_WRITE_KEY',
    host='https://YOUR_DATA_PLANE_URL',
    proxies={
        'http': 'http://proxy.example:8080',
        'https': 'http://proxy.example:8080',
    },
)

A legacy string such as proxy.example:8080 is also supported. The SDK applies the string to both HTTP and HTTPS requests. If the string has no scheme, the SDK adds http://. An existing scheme is preserved.

Configured proxies are now used for event requests. Earlier versions ignored this option. Check that any existing proxy configuration is reachable before upgrading.

About RudderStack

RudderStack is a customer data platform for developers. Our tooling makes it easy to deploy pipelines that collect customer data from every app, website and SaaS platform, then activate it in your warehouse and business tools.

More information on RudderStack can be found here.

Contact Us

For more information on any of the sections covered in this readme, you can contact us or start a conversation on our Slack channel.

About

Python SDK for event streaming in RudderStack - an open-source, warehouse-first customer data pipeline.

Topics

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages