Forums

[Errno 110] Connection timed out while connecting using Requests

Hi guys,

My web app will connect to a national courier's API through requests lib for results. However I've been receiving [Errno 110] Connection timed out

2016-03-26 04:32:03,655 :Internal Server Error: /
Traceback (most recent call last):
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/lotus92/poslaju/poslaju_web/tracking/views.py", line 19, in list
    return process_manager.Poslaju(request.FILES['docfile'], result).main()
  File "/home/lotus92/poslaju/poslaju_web/tracking/process_manager.py", line 81, in main
    result = requests.get(request_url).content
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/requests/api.py", line 67, in get
    return request('get', url, params=params, **kwargs)
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/lotus92/.virtualenvs/django/local/lib/python2.7/site-packages/requests/adapters.py", line 437, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='api.pos.com.my', port=80): Max retries exceeded with url: /v2TrackNTraceWebApi/api/Details/eg51613
2847my?callback=jQuery110204597350114595653_1458828384070&sKey=7oHHMvxM0&_=1458828384074 (Caused by NewConnectionError('<requests.packages.u
rllib3.connection.HTTPConnection object at 0x7fa45757b850>: Failed to establish a new connection: [Errno 110] Connection timed out',))

I'm a beginner in web app and I have been digging for the solution on Internet but until now no avail, can someone enlighten me on this issue please? The code works perfectly fine on my local environment though.

Thanks

Are you using a free account? If so, you may need to ask PA to allow access to that site by adding it to the PA 'white list'.

@jgmdavies No I'm not, with the $5 monthly plan.

could they be blocking you on their end? what happens if you use requests to make the same api call from the console?

@conrad from PA console it is the same result too, errno 110 but at the same time I tried it using my local console and it works.

Had you only just upgraded to a paid account when you were trying this? The new settings for external internet access are only applied in new consoles, or if you reload your web application, after you've upgraded.