rongardF / tvdatafeed

A simple TradingView historical Data Downloader
MIT License
281 stars 153 forks source link

About the __auth error #23

Closed esiwgnahz closed 1 year ago

esiwgnahz commented 1 year ago

Recently, perhaps after an update of Tradingview, a problem of __auth error for obtaining the token occurs when I try to download data with TvDatafeed(username, password) inside a loop. Without the token, the download data are delayed.

The response.json() shows "Please confirm that you are not a robot by clicking the captcha box". I am working on a Linux server and cannot see the captcha.

Should set a way using cookie or session id to obtain the token instead frequent login for avoiding this problem?

Does anyone know how to solve this? Thank you!

esiwgnahz commented 1 year ago

A simple way is to save the tv to a pickle file as following:

tv = TvDatafeed(username, password)

with open('tv.pickle', 'wb') as f:
    pickle.dump(tv, f)

Then load the saved pickle when using

with open('tv.pickle', 'rb') as f:
     tv = pickle.load(f)