Skip to main content

HasOffers

https://pypip.in/version/hasoffers/badge.svg https://pypip.in/format/hasoffers/badge.svg https://travis-ci.org/jthi3rry/hasoffers.svg?branch=master https://coveralls.io/repos/jthi3rry/hasoffers/badge.png?branch=master https://pypip.in/py_versions/hasoffers/badge.svg https://pypip.in/license/hasoffers/badge.svg

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

Metadata

Release files for hasoffers 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hasoffers 0.2.1
File Size Uploaded Provenance Actions
hasoffers-0.2.1.tar.gz 5.2 kB Without provenance Details for hasoffers-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hasoffers 0.2.1
File Interpreter ABI Platform Actions
hasoffers-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for hasoffers-0.2.1-py2.py3-none-any.whl

Total release size: 11.2 kB

Release files / hasoffers-0.2.1.tar.gz

Download URL hasoffers-0.2.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
559b9054564d038df0df0c4ebe180595049279066eb0b8a99dbbe1f64125ca7c
BLAKE2b-256 checksum
How to use checksums
152656d5d3ee4b5bd402bf8e36b0da7007102f26445a85ebe32804a2a2d785f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hasoffers-0.2.1-py2.py3-none-any.whl

Download URL hasoffers-0.2.1-py2.py3-none-any.whl
Size 6.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
338877df003593218c4f1b6be62458f16fda991e021961881604b80851f28e84
BLAKE2b-256 checksum
How to use checksums
52768ef892913bdb13f7585122e4683ab07325f5ffbd27f4c7bac62181c69ab9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for hasoffers 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page