Closed gdsdheemanth closed 5 years ago
Hi, seems you are using python 3.6. Could you please try below and let me know if it works for you?
from suds.client import Client
client = Client("https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl")
print(client)
Besides, are you using proxy?
hi qitia, thanks for the reply I ran the code which you have given using a proxy
def test():
from suds.client import Client
client = Client(
"https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl")
d={'http':proxy_url}
client.set_options(proxy = d)
print(client)
it is throwing urlopen error timed out error error msg:
ERROR - <urlopen error timed out>
Traceback (most recent call last):
File "/usr/lib64/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib64/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib64/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib64/python3.6/http/client.py", line 1392, in connect
super().connect()
File "/usr/lib64/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib64/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib64/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
socket.timeout: timed out
and next, I tried to run the same using curl at that time it has given the response
I think proxy is not stopping the URL to hit the server can you please help with this
thanks for the info @dheemanth1434. From this we can tell that 1) there is no issue from the service(api) side as you can access it with curl. 2) it is not the SDK(the python lib) issue since you repro it without using SDK.
I am thinking there is some network setting issue from your local... What is the behavior when try the first approach without proxy? something like below
def test():
from suds.client import Client
client = Client(
"https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl")
print(client)
hi @qitia, I ran the code
def test():
from suds.client import Client
client = Client(
"https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl")
print(client)
and its showing the urlopen timed out error
[2019-07-09 04:46:43,357] {python_operator.py:104} INFO - Exporting the following env vars:
AIRFLOW_CTX_DAG_ID=bingadstest
AIRFLOW_CTX_TASK_ID=bingads_check
AIRFLOW_CTX_EXECUTION_DATE=2019-07-09T04:46:09.176316+00:00
AIRFLOW_CTX_DAG_RUN_ID=manual__2019-07-09T04:46:09.176316+00:00
[2019-07-09 04:48:13,465] {__init__.py:1580} ERROR - <urlopen error timed out>
Traceback (most recent call last):
File "/usr/lib64/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib64/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib64/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib64/python3.6/http/client.py", line 1392, in connect
super().connect()
File "/usr/lib64/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib64/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib64/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/airflow/models/__init__.py", line 1441, in _run_raw_task
result = task_copy.execute(context=context)
File "/usr/local/lib/python3.6/site-packages/airflow/operators/python_operator.py", line 112, in execute
return_value = self.execute_callable()
File "/usr/local/lib/python3.6/site-packages/airflow/operators/python_operator.py", line 117, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/opt/apache/airflow/data/dags/DP-marketing-dmm/testdagbda.py", line 28, in test
"https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl")
File "/usr/local/lib/python3.6/site-packages/suds/client.py", line 115, in __init__
self.wsdl = reader.open(url)
File "/usr/local/lib/python3.6/site-packages/suds/reader.py", line 150, in open
d = self.fn(url, self.options)
File "/usr/local/lib/python3.6/site-packages/suds/wsdl.py", line 136, in __init__
d = reader.open(url)
File "/usr/local/lib/python3.6/site-packages/suds/reader.py", line 74, in open
d = self.download(url)
File "/usr/local/lib/python3.6/site-packages/suds/reader.py", line 92, in download
fp = self.options.transport.open(Request(url))
File "/usr/local/lib/python3.6/site-packages/suds/transport/https.py", line 62, in open
return HttpTransport.open(self, request)
File "/usr/local/lib/python3.6/site-packages/suds/transport/http.py", line 67, in open
return self.u2open(u2request)
File "/usr/local/lib/python3.6/site-packages/suds/transport/http.py", line 132, in u2open
return url.open(u2request, timeout=tm)
File "/usr/lib64/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib64/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib64/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error timed out>
hi @dheemanth1434 it seems to me neither the microsoft ads api issue nor the SDK problem. Could you please try url "https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl". If this does not work either, I think you should check from you local settings.
def test():
from suds.client import Client
client = Client(
"https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl")
print(client)
Hi Team, I am running the bingads API call in the server. After loading the credentials it is trying to open the URL (https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/v13/ReportingService.svc?singleWsdl) after some time it is throwing a urllib.error.URLError:
can someone help with this?
FYI, I am attaching the log.
bingadslog.txt