Python bindings for Sift Science's Partnerships API
Project description
============================
Sift Science Partnership API |TravisCI|_
============================
.. |TravisCI| image:: https://travis-ci.org/SiftScience/sift-partner-python.svg?branch=master
.. _TravisCI: https://travis-ci.org/SiftScience/sift-partner-python
Bindings for Sift Science's `Partnerships API <https://siftscience.com/resources/references/partner-api.html>`_.
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
"shopowner@merchantsite.com", # an email belonging to the merchant
"johndoe@merchantsite.com", # 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
0.0.3 (2016-06-30)
==================
* Added handling of next_ref for get_accounts
0.0.2 (2014-11-06)
==================
* Python REST library for Partnerships API
Sift Science Partnership API |TravisCI|_
============================
.. |TravisCI| image:: https://travis-ci.org/SiftScience/sift-partner-python.svg?branch=master
.. _TravisCI: https://travis-ci.org/SiftScience/sift-partner-python
Bindings for Sift Science's `Partnerships API <https://siftscience.com/resources/references/partner-api.html>`_.
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
"shopowner@merchantsite.com", # an email belonging to the merchant
"johndoe@merchantsite.com", # 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
0.0.3 (2016-06-30)
==================
* Added handling of next_ref for get_accounts
0.0.2 (2014-11-06)
==================
* Python REST library for Partnerships API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SiftPartner-0.0.3.tar.gz
(5.7 kB
view details)
File details
Details for the file SiftPartner-0.0.3.tar.gz
.
File metadata
- Download URL: SiftPartner-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 053f27934309ad8d694d18390aeeae425336980ae210e32957c4386e5727b85f |
|
MD5 | e170c22e2cdf5960f488b91f4e1e77df |
|
BLAKE2b-256 | 15adf45ac46e6142850f6cdd8fdd09b2478b4afd1f4095387f8e0c8207cf303e |