Skip to main content

Python bindings for Sift Science's API

Project description

============================
Sift Science Python Bindings
============================

Bindings for Sift Science's `REST API <https://siftscience.com/docs/rest-api>`_.

Installation
============

Get the package from pip (may be outdated):

Python 2:
::

pip install sift

Python 3:
::
pip3 install sift

or install directly from GitHub:

Python 2:
::

pip install git+https://github.com/SiftScience/sift-python

Python 3:
::

pip3 install git+https://github.com/SiftScience/sift-python

Usage
=====

Here's an example:

::

import sift.client

sift.api_key = 'XXXXXXXXXXXXXX' # TODO
client = sift.Client()

user_id= "23056" # User ID's may only contain a-z, A-Z, 0-9, =, ., -, _, +, @, :, &, ^, %, !, $

# Track a transaction event -- note this is blocking
event = "$transaction"

properties = {
"$user_id" : user_id,
"$user_email" : "buyer@gmail.com",
"$seller_user_id" : "2371",
"seller_user_email" : "seller@gmail.com",
"$transaction_id" : "573050",
"$payment_method" : {
"$payment_type" : "$credit_card",
"$payment_gateway" : "$braintree",
"$card_bin" : "542486",
"$card_last4" : "4444"
},
"$currency_code" : "USD",
"$amount" : 15230000,
}

response = client.track(event, properties)


response.is_ok() # returns True of False

print response # prints entire response body and http status code


# Request a score for the user with user_id 23056
response = client.score(user_id)

# Label the user with user_id 23056 as Bad with all optional fields
response = client.label(user_id,{ "$is_bad" : True, "$reasons" : ["$chargeback", ], "$description" : "Chargeback issued", "$source" : "Manual Review", "$analyst" : "analyst.name@your_domain.com"})



0.2.0 (2013-01-08)
==================
* Added Module-scoped API key.

0.1.1 (2014-02-21)
==================
* Bump default API version to v203.

0.1.0 (2013-01-08)
==================
* Just the Python REST client itself.

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

Sift-0.2.0.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file Sift-0.2.0.tar.gz.

File metadata

  • Download URL: Sift-0.2.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Sift-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c17a537297062ceccc2b9aac2d7ee96d081307bf8c71f4c771bb3849942ab24
MD5 32b82d5c56072643286720b340641c79
BLAKE2b-256 9de113e43bce6941c3367af1cb289bec33a91cff636fb5754147d0e8dc246caf

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