Skip to content

Bulk create custom targeting values for price targets #87

@Austinb

Description

@Austinb

I have noticed since the new api came out more issues with random connection issues with the DFP API when creating all of the price targeting values. I added a time.sleep() setting line 255 of add_new_prebid_partner.py but the issue seems to still happen randomly regardless of the sleep value used. I usually get an error related to the connection not responding from the API's side. I set the sleep to 0.1 without issues then that has issues. I bumped it to 0.5 and sometimes that has issues. I did 1.0 and had issues.

Has anyone else noticed any similar issues when creating the price targets? I have not seen any issues when creating the associations or any of the other calls. It seems like maybe the API has changed the requests per second or maybe the API is just having issues.

Usual error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1346, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1346, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 435, in <module>
    main()
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 430, in main
    creative_template_id=creative_template_id
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 97, in setup_partner
    creative_template_id=creative_template_id)
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 235, in create_line_item_configs
    hb_pb_value_id = HBPBValueGetter.get_value_id(price_str)
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 183, in get_value_id
    val_id = self._create_value_and_return_id(value_name)
  File "/home/path/dfp-prebid-setup/tasks/add_new_prebid_partner.py", line 170, in _create_value_and_return_id
    self.key_id)
  File "/home/path/dfp-prebid-setup/dfp/create_custom_targeting.py", line 77, in create_targeting_value
    values_config)
  File "/usr/local/lib/python3.6/dist-packages/googleads/common.py", line 992, in MakeSoapRequest
    *packed_args, _soapheaders=soap_headers)['body']['rval']
  File "/usr/local/lib/python3.6/dist-packages/zeep/proxy.py", line 45, in __call__
    kwargs,
  File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 122, in send
    response = client.transport.post_xml(options["address"], envelope, http_headers)
  File "/usr/local/lib/python3.6/dist-packages/zeep/transports.py", line 95, in post_xml
    return self.post(address, message, headers)
  File "/usr/local/lib/python3.6/dist-packages/zeep/transports.py", line 62, in post
    address, data=message, headers=headers, timeout=self.operation_timeout
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 567, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions