Skip to content

SiftScience/sift-partner-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sift Science Partnership API TravisCI

Bindings for Sift Science's Partnerships API.

Installation

Set up a virtual environment with virtualenv (otherwise you will need to make the pip calls as sudo):

virtualenv venv
source venv/bin/activate

Get the latest released package from pip:

Python 2:

pip install siftpartner

Python 3:

pip3 install siftpartner

or install newest source directly from GitHub:

Python 2:

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

Python 3:

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

Usage

Here's an example:

import siftpartner

partner_client = siftpartner.Client(api_key = '<your_rest_api_key_here>',
                                    partner_id = '<your_rest_api_key_here>')

# create a new account for a given merchant
response = partner_client.new_account(
  "merchantsite.com", # the url for the merchant's site
  "[email protected]", # an email belonging to the merchant
  "[email protected]", # an email used to log in to Sift
  "s0m3l0ngp455w0rd" # password associated with that log in
)


response.is_ok()  # returns True of False

print response # prints entire response body and http status code


# Get a list of all merchant accounts created by you
response = partner_client.get_accounts()

response.is_ok()  # returns True of False

print response # prints entire response body and http status code

# configure notification endpoint and threshold for you merchants
cfg = {
        # set the URL for notifications to arrive at.  The %s is replaced by the merchant's customer ID
        "http_notification_url": "http://api.partner.com/notify?id=%s",
        # Set the threshold to send notifications over. This is the Sift Score/100
        "http_notification_threshold": 0.60
      }
response = partner_client.update_notification_config(cfg)

response.is_ok()  # returns True of False

print response # prints entire response body and http status code

Testing

Before submitting a change, make sure the following commands run without errors from the root dir of the repository:

PYTHONPATH=. python tests/client_test.py
PYTHONPATH=. python3 tests/client_test.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages