This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This package provides a Python low-level client for the HasOffers API.

Installation

pip install hasoffers

Usage Examples

Instantiate a client with your network token and network id:

from hasoffers import BrandClient

client = BrandClient("networktoken", "networkid")

Or for the Affiliate API:

from hasoffers import AffiliateClient

client = AffiliateClient("api_key", "network_id")

The general usage to call an API method is client.request(target, method, **params).

For example, to retrieve all offer categories:

response = client.request("Application", "findAllOfferCategories",
                          filters={
                              "status": {"NOT_EQUAL": "deleted"}
                          })

if response.success:
    # do something with
    response.data

Or to retrieve all conversions for an advertiser:

response = client.request("Conversion", "findAll",
                          page=1,
                          limit=100,
                          filters={
                              "advertiser_id": 444,
                          })

if response.success:
    # do something with
    response.data

To use a combination of OR and AND in filters:

# Find all conversions where (advertiser_id == 444 OR advertiser_id == 555 OR revenue >= 100) AND user_agent contains "AppleWebKit"
response = client.request("Conversion", "findAll",
                          page=1,
                          limit=100,
                          filters={
                              "OR": {
                                  "advertiser_id": [444, 555],
                                  "revenue": {
                                      "GREATER_THAN_OR_EQUAL_TO": 100
                                  }
                              },
                              "user_agent": {
                                  "LIKE": "%AppleWebKit%"
                              }
                          })

Note that a special keyword argument called response_class can be passed to substitute the default response wrapper. For example:

from hasoffers import Response


class CustomResponse(Response):

    def next_page(self):
        return int(self.data.get('page')) + 1

    def has_more(self):
        return int(self.data.get('page')) < int(self.data.get('pageCount'))


response = client.request("Conversion", "findAll",
                          limit=100,
                          page=1,
                          response_class=CustomResponse)

Running Tests

tox

Contributions

All contributions and comments are welcome.

Change Log

v0.2.1

  • Add ability to specify HTTP methods (verbs) when making a request. Thanks jeffkayser

v0.2.0

  • Add support for Affiliate API. Thanks jarradh

v0.1.1

  • Switch to Semantic Versioning
  • Fix issue with parse_requirements for newer versions of pip (>=6.0.0)

v0.1

  • Initial
Release History

Release History

0.2.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
hasoffers-0.2.1-py2.py3-none-any.whl (6.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel May 23, 2015
hasoffers-0.2.1.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source May 23, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting