Skip to main content

A library for interacting with RapLeaf's Personalization API

Project description

Copyright 2010 Rapleaf

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

For general information regarding the personalization API, visit http://www.rapleaf.com/developers/api_docs/personalization/direct. The personalization API’s terms and conditions are stated at http://www.rapleaf.com/developers/api_usage.

How to Use

Installation

easy_install rapleafApi

Usage

>>> from rapleafApi import RapleafApi
>>> api = RapleafApi.RapleafApi('API_KEY')
>>> api.query_by_email('test@example.com')
{u'gender': u'Male', u'age': u'25-34'}

Query Options

The egg supports several ways to query Rapleaf’s API: email, hashed email (either MD5 or SHA1 hash), name and postal (NAP), or name and ZIP+4 (NAZ).

query_by_email(self, email, hash_email = False, show_available = False)

This method queries Rapleaf’s API with the specified email.
If the hash_email option is set, then the email will be hashed before it’s sent to Rapleaf.
If the show_available option is set, then the string “Data Available” will be returned for those fields which the API account is not subscribed but for which RapLeaf has data.
query_by_md5(self, md5_email, show_available = False)
query_by_sha1(self, sha1_email, show_available = False)
These methods query Rapleaf’s API with the specified email hashes (either MD5 or SHA1, respectively).
If the show_available option is set, then the string “Data Available” will be returned for those fields which the API account is not subscribed but for which RapLeaf has data.

query_by_nap(self, first, last, street, city, state, email = None, show_available = False)

This method queries Rapleaf’s API with a name and postal address: first name, last name, street, city, and state acronym (i.e., the state’s 2-character postal code).
Though not necessary, adding an e-mail increases hit rate.
If the show_available option is set, then the string “Data Available” will be returned for those fields which the API account is not subscribed but for which RapLeaf has data.

query_by_naz(self, first, last, zip4, email = None, show_available = False)

This method queries Rapleaf’s API with a name and ZIP+4 code. The ZIP+4 is a string with a 5-digit ZIP code and 4-digit extension separated by a dash.
Though not necessary, adding an e-mail increases hit rate.
If the show_available option is set, then the string “Data Available” will be returned for those fields which the API account is not subscribed but for which RapLeaf has data.

Contributing

If you have suggestions or patches, feel free to email us at <developer at rapleaf dot com>. We look forward to hearing from you!

Contributors

Nicole Allard <nicole at rapleaf dot com>

Dependencies

urllib3

easy_install urllib3

or visit the url https://github.com/shazow/urllib3/zipball/master. Once you’ve unzipped the download, open a terminal window and navigate to the folder into which you unzipped the download. When you open the folder, one of the subdirectories is ‘urllib3.’ Open it. It contains a script called setup.py which you’ll run via the command ‘python setup.py install’.

Note that, on unsuccessful requests, we raise an error. Unsuccessful requests are any requests which send back an http response status outside of the range 200 <= status < 300.

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

RapLeafApi-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file RapLeafApi-0.1.1.tar.gz.

File metadata

  • Download URL: RapLeafApi-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for RapLeafApi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e26293ef1851fa4633fb077c7e0a5ca5e04275a99e04df25dee427f9a87d145
MD5 c1c991a2d70506d4c787368f452bc52a
BLAKE2b-256 c29f33f4162f5a9862976febab80246d69b0338c4be1491d696b917611a18e0c

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