Skip to main content

Python

The official Talon.One Python SDK can be found on GihHub. The SDK supports both the Integration API and Management API, and can be used on Python 2 or 3.

# Fill in the details of your Talon.One Application here
application_id = 15025
application_key = '41d3f05e76fd667b'
talon = integration.Client('https://mycompany.talon.one', application_id, application_key)
# When the customer registers or updates their account
talon.update_customer_profile("my_unique_profile_id", {
"attributes": {
"name" => "Val Kust",
"billingAddress1": "21 Jump St."
}
})
# When the customer adds an item to their cart
result = talon.update_customer_session("my_unique_session_id", {
"profileId": "my_unique_profile_id",
"cartItems": [{
"name": "Shiny Red Shoes",
"sku": "srs_1234",
"price": 49.99,
"quantity": 1,
"currency": "USD"
}],
"attributes": {
"ShippingCost": 3.75
},
"total": 53.74
})
# Track a custom event related to opened session
talon.track_event("my_unique_session_id", "viewed_promo_page", {"url": "http://example.com/summer-shoes-2016"})
# Finally you close session to finalize whole transaction
talon.close_customer_session("my_unique_session_id")