示例#1
0
def get_dynamic(user_id, client_api_token, user_token):
    authorization = 'Bearer %s' % (user_token)
    headers = {
        'MyApp-AccessToken': client_api_token,
        'Authorization': authorization
    }
    return http_client.get(dynamic_url(user_id), headers=headers).json()
示例#2
0
def public_get_vast_wrapper(partner, user_id, device_id, vast_url):
    url = '%s/ads/v1/vast-wrapper/%s/%s/%s' % (
        config.url('ads'), partner['id'], user_id, device_id)
    params = {'vastUrl': vast_url}
    headers = {'MyApp-PartnerId': partner['id']}
    return http_client.get(url,
                           params=params,
                           headers=headers,
                           valid_codes={200})
示例#3
0
def public_get(playable_id, partner, device_type=None, user_token=None):
    url = '%s/ads/v1/%s' % (config.url('ads'), playable_id)
    # NOTE: api_global takes the MyApp-AccessToken (clientApiToken) header
    # and sets the MyApp-PartnerBackendSecret and MyApp-PartnerId headers
    headers = {
        'MyApp-PartnerId': partner['id'],
        'MyApp-PartnerBackendSecret': partner['backendSecret'],
        # 'MyApp-AccessToken': partner['clientApiToken'],
        'MyApp-Play-DeviceType': device_type
    }
    if user_token:
        headers['Authorization'] = 'Bearer %s' % (user_token)
    return http_client.get(url, headers=headers, valid_codes={200, 404, 400})
示例#4
0
def get_offer(partner_id, offer_id):
    url = '%s/offer/v1/offers/%s' % (config.url('offer'), offer_id)
    return http_client.get(url, headers=headers(partner_id))
示例#5
0
def list_packs(partner_id):
    url = '%s/offer/v1/packs' % (config.url('offer'))
    return http_client.get(url, headers=headers(partner_id))
示例#6
0
def get_pack(partner_id, pack_id):
    url = '%s/offer/v1/packs/%s' % (config.url('offer'), pack_id)
    return http_client.get(url, headers=headers(partner_id))
示例#7
0
def search(partner_id):
    url = '%s/offer/v1/search' % (config.url('offer'))
    return http_client.get(url, headers=headers(partner_id))
示例#8
0
def get(partner_id):
    return http_client.get(get_url(partner_id))
示例#9
0
def query(partner_id, query):
    url = api_url(f'/query?q={query}&size=-1')
    return http_client.get(url, headers=headers(partner_id))
示例#10
0
def get_history(user_id, partner_id):
    return http_client.get(url(user_id, '/history'), headers=headers(partner_id))
示例#11
0
def public_get_tracking(partner, user_id, device_id):
    url = '%s/ads/v1/vast-tracking/%s/%s/%s' % (
        config.url('ads'), partner['id'], user_id, device_id)
    headers = {'MyApp-PartnerId': partner['id']}
    return http_client.get(url, headers=headers, valid_codes={204})
示例#12
0
def internal_defaults_list():
    return http_client.get(internal_defaults_list_url())
示例#13
0
def internal_defaults_get(partner_id):
    return http_client.get(internal_defaults_get_url(partner_id))
示例#14
0
def list_offers(partner_id, pack_id):
    url = '%s/offer/v1/offers' % (config.url('offer'))
    params = {'packId': pack_id}
    return http_client.get(url, params=params, headers=headers(partner_id))
示例#15
0
def internal_get(partner_id, playable_id):
    return http_client.get(internal_get_url(partner_id, playable_id))
示例#16
0
def get_subscription(user_id, partner_id):
    return http_client.get(url(user_id), headers=headers(partner_id))
示例#17
0
def internal_list(partner_id):
    return http_client.get(internal_list_url(partner_id))
示例#18
0
def get_payments(partner, user):
    url = api_url(f'/users/{user["userId"]}/payments')
    return http_client.get(url, headers=headers(partner, user))
示例#19
0
def get_subscription(user_id, client_api_token, user_token):
    url = '%s/superscription/v2/users/%s/subscription' % (config.url('api_global'), user_id)
    authorization = 'Bearer %s' % (user_token)
    headers = {'MyApp-AccessToken': client_api_token, 'Authorization': authorization}
    return http_client.get(url, headers=headers)