4

I am able to access the below "URL" mentioned in code manually in firefox browser and see the json response as :

{ "version" : "1.0", "email_address" : "[email protected]" } 

But when I am trying to do get request with below code I am getting connection timeout error.

import requests URL='https://deviceconfig.pod1.pie.avatar.ext.hp.com/virtualprinter/v1/printers/emailaddress/AQAAAAFiGLv5GQAAAAGrHfgO' proxies = {'http': '', 'https': ''} headers={'User-Agent':'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'} try: r= requests.get(url=URL,proxies=proxies,verify=False,headers=headers) print r.status_code print r.content except requests.exceptions.RequestException as e: print e.message Error : HTTPSConnectionPool(host='deviceconfig.pod1.pie.avatar.ext.hp.com', port=443): Max retries exceeded with url: /virtualprinter/v1/printers/emailaddress/AQAAAAFiGLv5GQAAAAGrHfgO (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fd9f45080d0>: Failed to establish a new connection: [Errno 110] Connection timed out',)) 
1
  • You have a network problem, it could be related to your proxy settings. Commented Mar 12, 2018 at 12:03

1 Answer 1

4

Now Get request is working , by setting the proxies with port number.

Added proxy setting in above code:

proxies = { 'http': 'web-proxy.xxxxxx.xx.com:8080','https': 'web-proxy.xxxxxx.xx.com:8080'} Output : 200 { "version" : "1.0", "email_address" : "[email protected]" } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.