question

Upvotes
Accepted
39 0 2 3

PyDSWS ConnectionError

I have trouble with the login

ds = PyDSWS.Datastream(username='XXX', password='YYY')

This raises a connection error:

ConnectionError: HTTPConnectionPool(host='product.datastream.com', port=80): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/Token?username=XXX&password=YYY (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000000000A5FF588>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

How should I trouble shoot?

datastream-apidsws-apiconnection
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
39 0 2 3

I have managed to get access now by passing an extra argument containing proxies to PyDSWS\datastream.py.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi,

can you please share a bit more detail? Can you post part of the code you used?

There are several ways to do it. For instance you can use os.environ["http_proxy"]="XXX".

can you please post an example on this? thanks

Upvotes
1.1k 3 3 3

@8477ab9c-f15e-4a78-9279-fd670f296382

Error "[Errno 11004] getaddrinfo failed" suggest there is an issue with your network, probably corporate firewall/proxy issue. Please contact your corporate IT administrator for help.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
39 0 2 3

Yes, I need to go through a proxy. How can I pass the proxy setup/information into PyDSWS?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0

@ling.bao - How can I pass the proxy setup/information into PyDSWS? I am having the same issue as my project runs using a localhost. Can someone post a full example? thanks

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

import os
os.environ["http_proxy"] = "http://psw:username@proxy_address:8080"

os.environ["https_proxy"] = "http://psw:username@proxy_address:8080"

where psw, username and proxy_address are the information you need to fill in yourself.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.