Replies: 1 comment 1 reply
-
Yes, you need to pass your own cookies. You can get them by authenticating through the API. Can you try this code and tell me if it works? the import requests.cookies
session = requests.Session()
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Referer': 'https://www.tradingview.com'
}
data = {
"username": '...',
"password": '...',
"remember": "on",
}
r = session.post('https://www.tradingview.com/accounts/signin/', headers=headers, data=data)
if 'error' in r.json():
print(r.json())
print(session.cookies['sessionid'])
from tradingview_screener import Query
Query().select('update_mode').get_scanner_data(cookies={'sessionid': session.cookies['sessionid']}) Dont run this code too many times, otherwise it will start asking for captcha (which you can't solve through requests). And don't share your cookies online. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi for live data will need data subscription. Is it possible to pass the user credentials via api?
Beta Was this translation helpful? Give feedback.
All reactions