Forums

HTTPSConnectionPool(host='scanner.tradingview.com', port=443): Max retries exceeded with url: /crypto/scan (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

i get tish error when i run my site

Free accounts can only access sites on our whitelist. We can only whitelist sites that have a publicly documented API. Send us a link to the API documentation and we will consider the site for the whitelist.

https://www.tradingview.com/rest-api-spec/

That site doesn't seem to mention scanner.tradingview.com.

https://python-tradingview-ta.readthedocs.io/en/latest/usage.html

Can you provide us with a documentation from www.tradingview.com that mentions that endpoint?

I find mention of the endpoint only in github ( https://github.com/brian-the-dev/python-tradingview-ta/blob/main/tradingview_ta/main.py ), but as you can see Tradingview.com is a legit website.

Sure, our policy is that we whitelist the domains that allow programmatic collection of data by exposing a public APIs -- such APIs are expected to have an official documentation that mentions the available endpoints.

Hi, found this when googling the error code. I actually made a paid account specifically to access this site but I'm still receiving the same area code. Is there any workaround?

from tradingview_screener import Query, Column

to_add = (Query()
 .select('name', 'close', 'volume', 'Average Volume (10 day)')
 .where(
     Column('close').between(10, 100),
     Column('Average Volume (10 day)') > 20000000,
     Column('type').isin(['stock'])
 )
 .order_by('average_volume_10d_calc', ascending=False)
 .limit(250)
 .get_scanner_data())[1]['name']

Full code that caused the error:

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/tradingview_screener/query.py", line 663, in get_scanner_data
    r = requests.post(self.url, json=self.query, **kwargs)
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/workinprogress49/.local/lib/python3.10/site-packages/requests/adapters.py", line 694, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='scanner.tradingview.com', port=443): Max retries exceeded with url: /america/scan (Caused by ProxyError('Cannot connect to pro
xy.', OSError('Tunnel connection failed: 403 Forbidden')))

How do you run it?

I am running the program using the "tradingview-screener" library, documentation here: https://pypi.org/project/tradingview-screener/

This code will output the same error with the library installed.

from tradingview_screener import Scanner
Scanner.premarket_gainers.get_scanner_data()

But, do you run it in the console, web app, task?

I tried running it on console. I would like to set it up as a task script and eventually make it a web app. I haven't tested it as a task or on a web app but I would like it to function on all three.

Could you try again in a completely fresh console?

I did and it worked, thank you

Nice!