如何将用户列表上传到DoubleClick Exchange

时间:2019-08-24 05:33:47

标签: google-ad-exchange

我提供了一项服务,可使用下文所述的批量上传器将IDFA列表上传到DoubleClick服务器以进行预定位。 https://developers.google.com/authorized-buyers/rtb/bulk-uploader

我编写了一个简单的单元测试来测试以下端点。 https://cm.g.doubleclick.net/upload?nid= {MyGoogleNetworkId} 但是,返回了http状态代码404 Bad Request。此批量上传器服务仍然可以正常使用吗?

def upload_list():
    protobuf_obj = UpdateUsersDataRequest()

    newidslot = protobuf_obj.ops.add()
    newidslot.user_id_type = UserIdType.Value("ANDROID_ADVERTISING_ID")
    newidslot.user_id = "2024D65F-EBBD-11FF-23AB-823FC255913A"
    newidslot.user_list_id = 834590004
    newidslot.delete = False

    r = requests.post(
        GOOGLE_UPLOAD_ENDPOINT,
        data=protobuf_obj.SerializeToString(),
        headers={'Content-type': 'application/octet-stream'}
    )

    if r.status_code == 400:
        print "Http Error 400 Bad Request"

    result = UpdateUsersDataResponse()
    result.ParseFromString(r.content)
    if result.status == 0:
        print "NO_ERROR"
    elif result.status == 1:
        print "PARTIAL_SUCCESS"
        failcnt = 0
        for i in result.errors:
            print "   failed: ", i.user_id, i.error_code
            failcnt += 1
        print failcnt
    else:
        print "report failed. result code is ", result.status

0 个答案:

没有答案