keitaro is a simple and easy to use API wrapper library for Keitaro Admin API written in Python3 and requests
Pypi package is not updated, you can build it using setup.py
Begin by importing Keitaro class from keitaropy module and passing Admin API key and URL of Keitaro tracker to it
from keitaropy import Keitaro
api = Keitaro('API key', 'URL')
All keitaropy functionality is presented in Google Sheet
If API request was successful, status code 200 will be received and a response in the json format. Use json()
method to see the response data
from keitaropy import Keitaro
api = Keitaro('API key', 'URL')
affnetwork = api.affnetworks.delete(14)
print(affnetwork.json())
Click to see a response sample Admin API reference
{ "id": 14, "name": "string", "postback_url": "string", "offer_param": "string", "state": "string", "template_name": "string", "notes": "string", "pull_api_options": "string", "created_at": "string", "updated_at": "string", "offers": "string" }
To get all offers call get() method without any arguments
all_offers = api.offers.get()
Let's try to get a specific offer by its id
dummy_offer = api.offers.get(21)
As a result you'll get a response in JSON format
Click to see a response sample
[ { "id": 21, "name": "string", "group_id": 0, "action_type": "string", "action_payload": "string", "action_options": [], "affiliate_network_id": 0, "payout_value": 0, "payout_currency": "string", "payout_type": "string", "state": "string", "created_at": {}, "updated_at": {}, "payout_auto": true, "payout_upsell": true, "country": [], "notes": "string", "affiliate_network": "string", "archive": "string", "local_path": "string", "preview_path": "string" } ]
To create an advertising campaign, you can simply call create() method of the campaigns resource
payload = {
'name': 'Dummy campaign',
'state': 'disabled',
'cost_type': 'CPC',
'cost_value': '5',
'cost_currency': 'USD',
'cost_auto': True
}
campaign = api.campaigns.create(payload)