Yahoo Finance V7 API jetzt benötigt Kekse? (Python)

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Yahoo Finance V7 API jetzt benötigt Kekse? (Python)

by Anonymous » 02 Jun 2025, 19:15

Code: Select all

url = 'https://query2.finance.yahoo.com/v7/finance/quote?symbols=TSLA&fields=regularMarketPreviousClose&region=US&lang=en-US'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
}
data = requests.get(url,headers=headers)
prepost_data = data.json()
< /code>
Es scheint, dass Yahoo Finance ihre V7 -API so geändert hat, dass sie für jede Anfrage Cookies benötigt. Ausführen des obigen Code{"finance":{"result":null,"error":{"code":"Unauthorized","description":"Invalid Crumb"}}}

Dieses Problem scheint auch in diesem Github Repo bekannt zu sein: https://github.com/joshuaulrich/quantmo ... /tsues/p.p>
Sie scheinen ein Patch zu haben, das funktioniert: https://github.com/joshuaulrich/quantmo ... 83/commits
Aber der Code ist alles in r ... jemand weiß, wie man das in Python übersetzt?

Top