A Python wrapper around the Admitad API
pip install admitad
from admitad import api, items
client_id = "[client_id]"
client_secret = "[client_secret]"
scope = ' '.join(set([items.Me.SCOPE]))
client = api.get_oauth_client_client(
client_id,
client_secret,
scope
)
print(client.Me.get())
python setup.py test
res = client.Me.get()
res = client.Balance.get()
res = client.Balance.get(extended=True)
res = client.PaymentsSettings.get()
res = client.PaymentsSettings.get(currency='USD')
res = client.WebsiteTypes.get()
res = client.WebsiteTypes.get(limit=2, offset=1)
res = client.WebsiteRegions.get()
res = client.WebsiteRegions.get(limit=2, offset=1)
res = client.SystemLanguages.get()
res = client.SystemLanguages.get(limit=2, offset=1)
res = client.SystemLanguages.getOne(code='ru')
res = client.SystemCurrencies.get()
res = client.SystemCurrencies.get(limit=2, offset=1)
res = client.AdvertiserServices.get()
res = client.AdvertiserServices.get(limit=2, offset=1)
res = client.AdvertiserServices.getOne(1)
res = client.AdvertiserServices.getForKind(kind='website')
res = client.AdvertiserServices.getForKindOne(2, kind='website')
res = client.CampaignCategories.get()
res = client.CampaignCategories.get(campaign=10, language='en')
res = client.CampaignCategories.get(limit=2, offset=1)
res = client.CampaignCategories.getOne(2)
res = client.Coupons.get()
res = client.Coupons.get(order_by=['date_start', '-name'])
res = client.Coupons.get(order_by='-date_end')
res = client.Coupons.get(campaign=1, category=2)
res = client.Coupons.get(campaign=[1, 2], category=[2, 3])
res = client.Coupons.getOne(2)
res = client.CouponsForWebsite.get(2)
res = client.CouponsForWebsite.get(2, order_by=date_start)
res = client.CouponsForWebsite.get(2, campaign=1, category=2)
res = client.CouponsForWebsite.get(2, campaign=[1, 2], category=2)
res = client.CouponsForWebsite.getOne(2, 1)
res = client.CouponsCategories.get()
res = client.CouponsCategories.get(limit=10, offset=10)
res = client.CouponsCategories.getOne(2)
res = client.Websites.get(limit=10)
res = client.Websites.get(status='new', campaign_status='active')
res = client.Websites.getOne(2)
res = client.WebsitesManage.create(
name='website1',
kind='website',
language='ru',
adservice=2,
site_url='http://site.com',
description='description',
categories=[1, 2],
regions=['RU'],
atnd_hits=20,
atnd_visits=10,
mailing_targeting=False
)
res = client.WebsitesManage.update(50, name='test', language='de')
res = client.WebsitesManage.verify(50)
res = client.WebsitesManage.delete(50)
res = client.StatisticWebsites.get(website=1, campaign=1)
res = client.StatisticWebsites.get(subid="ADS778")
res = client.StatisticWebsites.get(limit=2)
res = client.StatisticWebsites.get(date_start='01.01.2013')
res = client.StatisticCampaigns.get()
res = client.StatisticCampaigns.get(website=1, campaign=1)
res = client.StatisticCampaigns.get(subid="ADS778")
res = client.StatisticCampaigns.get(limit=2)
res = client.StatisticCampaigns.get(date_start='01.01.2013')
res = client.StatisticDays.get()
res = client.StatisticDays.get(website=1, campaign=1)
res = client.StatisticDays.get(subid="ADS778")
res = client.StatisticDays.get(limit=2)
res = client.StatisticDays.get(date_start='01.01.2013')
res = client.StatisticMonths.get()
res = client.StatisticMonths.get(website=1, campaign=1)
res = client.StatisticMonths.get(subid="ADS778")
res = client.StatisticMonths.get(limit=2)
res = client.StatisticMonths.get(date_start='01.01.2013')
res = client.StatisticActions.get()
res = client.StatisticActions.get(date_start='01.01.2013')
res = client.StatisticActions.get(website=1, campaign=1)
res = client.StatisticActions.get(subid="ADS778")
res = client.StatisticActions.get(subid2="ADS778")
res = client.StatisticActions.get(limit=2)
res = client.StatisticSubIds.get()
res = client.StatisticSubIds.get(date_start='01.01.2013')
res = client.StatisticSubIds.get(subid="ADS778")
res = client.StatisticSubIds.get(subid1="ADS778", sub_id_number=2)
res = client.StatisticSubIds.get(limit=2)
res = client.StatisticSources.get()
res = client.StatisticSources.get(date_start='01.01.2013')
res = client.StatisticSources.get(limit=2)
res = client.StatisticKeywords.get()
res = client.StatisticKeywords.get(date_start='01.01.2013')
res = client.StatisticKeywords.get(limit=2)
res = client.Referrals.get()
res = client.Referrals.get(limit=2)
res = client.Referrals.getOne(2)
res = client.Banners.get(2)
res = client.Banners.get(2, mobile_content=False, limit=2)
res = client.BannersForWebsite.get(_id=2, w_id=3)
res = client.BannersForWebsite.get(2, 3)
res = client.BannersForWebsite.get(2, 3, uri_scheme='https', limit=5)
res = client.Campaigns.get()
res = client.Campaigns.get(limit=2)
res = client.Campaigns.getOne(2)
res = client.CampaignsForWebsite.get(22)
res = client.CampaignsForWebsite.get(limit=2)
res = client.CampaignsForWebsite.getOne(6, 22)
res = client.CampaignsManage.connect(6, 22)
res = client.CampaignsManage.connect(c_id=6, w_id=22)
res = client.CampaignsManage.disconnect(6, 22)
res = client.CampaignsManage.disconnect(c_id=6, w_id=22)
res = client.Payments.get()
res = client.Payments.get(limit=2, has_statement=True)
res = client.Payments.getOne(2)
res = client.PaymentsStatement.get(12)
res = client.PaymentsStatement.get(12, detailed=True)
res = client.PaymentsManage.create('USD')
res = client.PaymentsManage.confirm(71)
res = client.PaymentsManage.delete(71)
res = client.BrokenLinks.get()
res = client.BrokenLinks.get(website=[10, 20], date_start='01.01.2010')
res = client.BrokenLinks.getOne(10)
res = client.ManageBrokenLinks.resolve(10)
res = client.ManageBrokenLinks.resolve([10, 11, 12])
res = client.Announcements.get()
res = client.Announcements.getOne(10)
res = client.News.get()
res = client.News.get(limit=10, offset=20)
res = client.News.getOne(10)
res = client.LinksValidator.get('https://admitad.com/some_url/')
res = client.Landings.get(10)
res = client.Landings.get(10, limit=100)
res = client.LandingsForWebsite.get(10, 22)
res = client.LandingsForWebsite.get(10, 22, limit=100)
res = client.DeeplinksManage.create(22, 10, ulp='https://admitad.com/some/', subid='AS32djkd31')
res = client.ShortLinks.post(link='https://ad.admitad.com/g/some/')
res = client.Referrals.get()
res = client.Referrals.get(date_start='01.01.2010', date_end=datetime.today())
res = client.Referrals.getOne(181)
res = client.OptCodes.get()
res = client.OptCodes.get(campaign=100, order_by=['method', 'desc_mode')
res = client.OptCodes.getOne(11)
res = client.OfferStatusOptCodesManager.create(
website=10, campaign=100, desc_mode=0, method=l,
url='https://admitad.com/foobarbaz/'
)
res = client.OfferStatusOptCodesManager.update(
desc_mode=1, method=1
)
res = client.ActionOptCodesManager.create(
website=10, campaign=100, desc_mode=0, method=l,
url='https://admitad.com/foobarbaz/',
action_type=0, status=1
)
res = client.ActionOptCodesManager.update(
desc_mode=1, method=1, action_type=1, status=2
)
res = client.LostOrders.get()
res = client.LostOrders.get(limit=20, offset=0, appeal_status='processing')
res = client.LostOrders.getOne(76)
res = client.LostOrdersManager.create(
attachments=['/home/user/f.png', '/home/user/s.png'],
campaign=100, website=10,
order_id='039NRUHFJEW', order_date='12.08.2016', order_price=345.77,
comment='some comment'
)
res = client.LostOrdersManager.update(77, appeal_status='resolved')
res = client.LostOrdersManager.delete(77)
res = client.Retag.get()
res = client.Retag.get(website=10, active=False, limit=50)
res = client.Retag.getOne(54)
res = client.Retag.getLevelsForWebsite(10)
res = client.Retag.getLevelsForCampaign(100)
res = client.RetagManager.create(
website=10, level=22, active=False,
script='some js script', comment='some comment'
)
res = client.RetagManager.update(16, level=10, active=True)
res = client.RetagManager.delete(88)
res = client.Tickets.get()
res = client.Tickets.get(date_start='01.01.2016', status=0)
res = client.Tickets.getOne(50)
res = client.TicketsManager.create(
subject='subject', text='some text',
campaign=100, category=27, priority=0,
)
res = client.TicketsManager.comment(12, text='some comment')
It is possible to override the default response handler by passing handler as a keyword argument to a client function call. For example:
func = lambda x: (x, x)
result = client.Me.get(handler=func)