Skip to main content

A wrapper around the AWIN API.

Project description

awin-py

awin-py is a python wrapper around the AWIN API. The goals is to provide an easy to use interface for all AWIN API endpoints. It handles pagination, rate limiting, errors. Most information needed is available via docstrings, for further details please refer to the AWIN API docs.

>>> from advertiser_api.client import Awin
>>> Awin = Awin(client_id='***', client_secret='***')
>>> start_date = datetime.now() - timedelta(days=361)
>>> end_date = datetime.now()
>>> transactions = Awin.get_transactions(start_date=start_date, end_date=end_date)
>>> len(transactions)
1302
>>> transactions[0]
{"advertiserCost": {"amount": null, "currency": null},
 "advertiserCountry": "DE",
 "advertiserId": 11111,
 "amendReason": null,
 "amended": false,
 "basketProducts": null,
 "campaign": null,
 "clickDate": "2024-05-04T20:54:00",
 "clickDevice": "Android Mobile",
 "clickRefs": {"clickRef": "9184c7g4-9gbb-48g7-9e43-44717t5bed70"},
 "commissionAmount": {"amount": 4.26, "currency": "EUR"},
 "commissionSharingPublisherId": null,
 "commissionSharingSelectedRatePublisherId": null,
 "commissionStatus": "pending",
 "customParameters": [],
 "customerAcquisition": null,
 "customerCountry": "IE",
 "declineReason": null,
 "id": 1591984035,
 "ipHash": "-917875755098098",
 "lapseTime": 286,
 "networkFee": {"amount": 1.19, "currency": "EUR"},
 "oldCommissionAmount": null,
 "oldSaleAmount": null,
 "orderRef": "99439999999",
 "originalSaleAmount": null,
 "paidToPublisher": false,
 "paymentId": 0,
 "publisherId": 426667,
 "publisherUrl": null,
 "saleAmount": {"amount": 42.56, "currency": "EUR"},
 "siteName": "http://www.payback.de",
 "trackedCurrencyAmount": null,
 "transactionDate": "2024-05-14T20:59:00",
 "transactionDevice": "Linux",
 "transactionParts": [{"advertiserCost": null,
                       "amount": 42.56,
                       "commissionAmount": 4.26,
                       "commissionGroupCode": "DEFAULT",
                       "commissionGroupId": 167797,
                       "commissionGroupName": "Default",
                       "trackedParts": [{"amount": 42.56,
                                         "code": "DEFAULT",
                                         "currency": "EUR"}]}],
 "transactionQueryId": 0,
 "type": "Commission group transaction",
 "url": "http://www.payback.de",
 "validationDate": null,
 "voucherCode": "TESTTEST100",
 "voucherCodeUsed": true}

If something appears to be broken, please have a look at the open issues and vote for an existing issue or create a new one, if you can't find an issue that describes your problem.

Features

  • Aims to cover all functions of the Awin API (work in progress)
  • Python function wrappers for all API endpoints as part of the Awin class
  • Support for type hints

API Functions

awin-py currently only implements a subset of all available API features. This section gives an overview over which API endpoints are accessible through awin-py.

Available

  • Advertiser API
    • GET accounts
    • GET publishers
    • GET transactions (list)
    • GET transactions (ID)
    • GET reports aggregated by publisher
    • GET reports aggregated by creative
    • GET reports aggregated by campaign

Not yet implemented

  • Publisher API
  • Transaction Validation API

License

Copyright 2024 Friedrich ten Hagen

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.

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

awin_py-0.0.3.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

awin_py-0.0.3-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file awin_py-0.0.3.tar.gz.

File metadata

  • Download URL: awin_py-0.0.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.6

File hashes

Hashes for awin_py-0.0.3.tar.gz
Algorithm Hash digest
SHA256 786e4ef4193d09971bd6a1190835a32f7f09d5d2310c16c5034e2146495869ad
MD5 7f5fe8b4c0de6b1b2e08785227ef893c
BLAKE2b-256 66c9e068cd90f4ee1ce83c76c209763090dd5f880f8c65185af305f734c5577e

See more details on using hashes here.

File details

Details for the file awin_py-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: awin_py-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.6

File hashes

Hashes for awin_py-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f9f694d77fa8e6b7308380b4b26d30a8fbf1a2c46cfb675c90bfea7b448b355c
MD5 c38e81512f023afd1ad1bdf6d0a20eaf
BLAKE2b-256 a3f066c5079a31c127e634e50e04eafbd71eaa1cb5e6b1acb0248dede21b2bf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page