Forums

Got a ProxyError(Tunnel connection failed: 403 Forbidden) when connecting to LeanCloud(api.leancloud.cn)

I tried to connect LeanCloud but failed and got a ProxyError. I guessed it would be a whitelist problem. API doc (https://leancloud.readthedocs.io/zh_CN/latest/#leancloud) here.

OK -- that's now whitelisted, could you try again?

That what happen when I run it again,

import leancloud leancloud.init('F9btryhWbo42lk4IFsQ09mJj-gzGzoHsz','XcyMKN4OAwEpnSf83urGhcYM') Media = leancloud.Object.extend('Media')
media = Media() media.set('type','video') <leancloud.object_.Media object at 0x7f5af5932790> media.save() refresh app router failed: Traceback (most recent call last): HTTPSConnectionPool(host='app-router.leancloud.cn', port=443): Max retries exceeded with url: /2/route?appId=F9btryhWbo42lk4IFsQ09mJj-gzGzoHsz (Caus ed by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',))) File "<stdin>", line 1, in <module> File "/home/leelingkit/.local/lib/python2.7/site-packages/leancloud/object_.py", line 235, in save response = client.post('/classes/{0}?fetchWhenSave={1}'.format(self._class_name, fetch_when_save), data) File "/home/leelingkit/.local/lib/python2.7/site-packages/leancloud/client.py", line 90, in new_func return func(headers=headers, args, kwargs) File "/home/leelingkit/.local/lib/python2.7/site-packages/leancloud/client.py", line 147, in new_func response = func(*args, kwargs) File "/home/leelingkit/.local/lib/python2.7/site-packages/leancloud/client.py", line 209, in post hooks=request_hooks, File "/home/leelingkit/.local/lib/python2.7/site-packages/requests/sessions.py", line 549, in post return self.request('POST', url, data=data, json=json, kwargs) File "/home/leelingkit/.local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request resp = self.send(prep, send_kwargs) File "/home/leelingkit/.local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send r = adapter.send(request, *kwargs) File "/home/leelingkit/.local/lib/python2.7/site-packages/requests/adapters.py", line 502, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='f9btryhw.api.lncld.net', port=443): Max retries exceeded with url: /1.1/classes/Media?fetc hWhenSave=false (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))

I have no idea how to fix it.

It looks like the leancloud api redirects to a different domain for some things. I have added the additional domains.

Sorry to bother you guys again. This time, only these few lines of error messages,

refresh app router failed: HTTPSConnectionPool(host='app-router.leancloud.cn', port=443): Max retries exceeded with url: /2/route?appId=F9btryhWbo42 lk4IFsQ09mJj-gzGzoHsz (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))

Ok. I've tried to be more inclusive with the whitelisting.

Thank you so much. It works.

:)

Hi Guys,

I got kind of the same error:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.current-rms.com', port=443): Max retries exceeded with url: /api/v1/opportunities/checkout?subdomain=enfonic&apikey=PH-shFyyqdrZqgmZXcZf (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

Is it just the case of whitelisting current-rms.com?

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

Hello,

This is the link for the the API documentation: https://api.current-rms.com/doc

Ok. I have added that to the whitelist.

https://www.instapi.io/ can u please whitelist this site i really need to use this for a project

Hmm, I can't see any API documentation on that site. Could you give us a link to it?

Hi Guys,

I got similar message trying to read from www.westlotto.com:

page=requests.get('https://www.westlotto.com/wlinfo/WL_InfoService?gruppe=SpielplanToto&client=wlincl')

Traceback (most recent call last): File "<stdin>", line 1, in <module> 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.westlotto.com', port=443): Max retries exceeded with url: /wlinfo/WL_InfoService?gruppe=SpielplanToto&client=wl incl (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))

Could you please give me a hand?

See http://help.pythonanywhere.com/pages/403ForbiddenError/

Hi guys.

Found this topic, I have similar problem. I'm using tinyPNG.com for compression, have an api key.

I get error (long post, I think last few error lines can read what is wrong):

2018-10-22 16:56:23,130: Exception on /profile [POST]#012Traceback (most recent call last):#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 594, in urlopen#012 self._prepare_proxy(conn)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 805, in _prepare_proxy#012 conn.connect()#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/urllib3/connection.py", line 308, in connect#012 self._tunnel()#012 File "/usr/lib/python3.6/http/client.py", line 919, in _tunnel#012 message.strip()))#012OSError: Tunnel connection failed: 403 Forbidden#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/requests/adapters.py", line 449, in send#012 timeout=timeout#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen#012 _stacktrace=sys.exc_info()[2])#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment#012 raise MaxRetryError(_pool, url, error or ResponseError(cause))#012urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.tinify.com', port=443): Max retries exceeded with url: /shrink (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/tinify/client.py", line 58, in request#012 response = self.session.request(method, url, params)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/requests/sessions.py", line 524, in request#012 resp = self.send(prep, send_kwargs)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/requests/sessions.py", line 637, in send#012 r = adapter.send(request, kwargs)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/requests/adapters.py", line 510, in send#012 raise ProxyError(e, request=request)#012requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.tinify.com', port=443): Max retries exceeded with url: /shrink (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))#012#012The above exception was the direct cause of the following exception:#012#012Traceback (most recent call last):#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app#012 response = self.full_dispatch_request()#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request#012 rv = self.handle_user_exception(e)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception#012 reraise(exc_type, exc_value, tb)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise#012 raise value#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request#012 rv = self.dispatch_request()#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request#012 return self.view_functionsrule.endpoint#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/views.py", line 88, in view#012 return self.dispatch_request(*args, kwargs)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/flask/views.py", line 158, in dispatch_request#012 return meth(args, *kwargs)#012 File "/home/PinkFrojd/material_aukcije_online/controllers/profile_controller.py", line 42, in post#012 tinify.from_file(file).to_file(os.path.join(os.curdir,#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/tinify/init.py", line 79, in from_file#012 return Source.from_file(path)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/tinify/source.py", line 11, in from_file#012 return cls._shrink(path)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/tinify/source.py", line 26, in _shrink#012 response = tinify.get_client().request('POST', '/shrink', obj)#012 File "/home/PinkFrojd/.virtualenvs/aukcije_env/lib/python3.6/site-packages/tinify/client.py", line 64, in request#012 raise ConnectionError('Error while connecting: {0}'.format(err), cause=err)#012tinify.errors.ConnectionError: Error while connecting: HTTPSConnectionPool(host='api.tinify.com', port=443): Max retries exceeded with url: /shrink (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))

Post a link to their api docs and we'll consider it for inclusion in the whitelist.

Here is api link https://tinypng.com/developers/reference/python

We have added api.tinify.com to the whitelist

Hi guys.

i'm getting the same error

ProxyError: HTTPSConnectionPool(host='www.paynow.co.zw', port=443): Max retries exceeded with url: /Interface/Initiatetransaction (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 403 Forbidden',)))

Post a link to their api docs that shows it is using www.paynow.co.zw as an api endpoint and we'll consider it for inclusion in the whitelist.

Thank you see link below.. paynow docs

Hmm I can't find where it says that www.paynow.co.zw is the api endpoint

this is the end point from Paynow im using to initiate my transactions see link below.. https://developers.paynow.co.zw/docs/initiate_transaction.html

okay- we have added www.paynow.co.zw to the whitelist for you!

thank you

Hello! I'm trying to parse 4 sites that show simple tables in html for currency exchange, they are provided by local banks and they don't provide an API, so I have to use a request.get(). I'm getting the ProxyError, so I guess it's related to the whitelists.

Here is the error:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='banco.santanderrio.com.ar', port=443): Max retries exceeded with url: /exec/cotizacion/ind ex.jsp (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

This are the URLs I'm using:

  • https://banco.santanderrio.com.ar/exec/cotizacion/index.jsp
  • http://www.bna.com.ar/Personas
  • https://hb.bbv.com.ar/fnet/mod/inversiones/NL-dolareuro.jsp
  • https://www.bancochubut.com.ar/

As stated above, they don't provide APIs. Can they be whitelisted or I can't use pythonanywhere to scrap html tables?

Thanks in advance

Edited: grammar, etc.

If they don't provide an api that makes it explicit that they are okay with the public access it algorithmically, then we won't whitelist it. You will have to upgrade to a paying account to scrape it.

I see, thanks for the feedback! This is a hobby project of mine, so I'm just playing around.

Sadly, I don't know the reason for Argentinian banks not providing an API, even to their own customers.

Regards

Hello, Can you also put add support.kraken.com in the Whitelist ? api.kraken.com is already added.

requests.exceptions.ProxyError: HTTPSConnectionPool(host='support.kraken.com', port=443): Max retries exceeded with url: /hc/en-us/articles//205893708-What-is-the-min imum-order-size- (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

Kind regards

Send us a link to the API docs that show it is an API endpoint and we'll consider it.

Actually it's the ccxt package that uses this url as an API .

'api': { 'public': 'https://api.kraken.com', 'private': 'https://api.kraken.com', 'zendesk': 'https://support.kraken.com/hc/en-us/articles/', },

See line 77 in this https://github.com/ccxt/ccxt/blob/master/python/ccxt/kraken.py

We need the publicly available API documentation of the site in question.

I'm afraid no API doc is available for support.kraken.com, only for api.kraken.com :-( I'm only trying to test the ccxt package and they consider support.kraken.com as an api for some requests. If you can't add support.kraken.com in the whitelist, I understand and you can close this request. Thanks anyway for the feedback

Yes, unfortunately we can only whitelist something if there is official documentation :-(

Ok fair enough, I'll contact the CCXT team to avoid calls to the support.kraken.com from their package.