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/