Forums

Got a ProxyError(Tunnel connection failed: 403 Forbidden) when connecting to diff news api

I am trying to fetch images from news APIs. This is throwing an error

Traceback (most recent call last):                                                                                                                                                      
  File "fbPage.py", line 37, in <module>                                                                                                                                                
    f.write(requests.get(str(data['picture'])).content)                                                                                                                                 
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 72, in get                                                                                                        
    return request('get', url, params=params, **kwargs)                                                                                                                                 
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request                                                                                                    
    return session.request(method=method, url=url, **kwargs)                                                                                                                            
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 512, in request                                                                                              
    resp = self.send(prep, **send_kwargs)                                                                                                                                               
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 622, in send                                                                                                 
    r = adapter.send(request, **kwargs)                                                                                                                                                 
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 507, in send                                                                                                 
    raise ProxyError(e, request=request)                                                                                                                                                
requests.exceptions.ProxyError: HTTPSConnectionPool(host='c.ndtvimg.com', port=443): Max retries exceeded with url: /2019-04/deppsmk8_imran-khan-reuters_625x300_24_April_19.jpg (Caused
 by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))                                                                                          
05:28 ~ $

Every time it will be a random URL to any of the images obtained from News API.

[edit by admin: formatting]

Free accounts are limited to accessing sites on our whitelist. If the site you're trying to connect to is part of an official public API, then you can post a link to the documentation of the API here in the forums, and we'll see if we can add it.

are paid accounts allowed to do the above? or they are limited too ?

Paid accounts don't have this limit

Traceback (most recent call last): File "/home/chandana1408/db_testing.py", line 19, in <module> g=requests.get("https://www.kitco.com/gold-price-today-canada/index.html") File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 72, in get return request('get', url, params=params, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 512, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 622, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 507, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.kitco.com', port=443): Max retries exceeded with url: /gold-price-today-canada/index.html (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))

Send us a link to the API documentation and we'll consider it for the whitelist.