Skip to content

Error 401 Unauthorized when fetching data for any symbol (e.g., AAPL) #59

Description

@Hanhan1989

I am encountering an error when attempting to download historical data for any stock symbol from Yahoo Finance. For instance, when requesting data for the symbol AAPL, the request is made to the following URL:

https://query2.finance.yahoo.com/v7/finance/download/AAPL?period1=1735599600&period2=1735686000&interval=1d&events=history
The response received is:

Error fetching data for symbol AAPL: Client error: GET https://query2.finance.yahoo.com/v7/finance/download/AAPL?period1=1735599600&period2=1735686000&interval=1d&events=history` resulted in a 401 Unauthorized response: {"finance":{"result":null,"error":{"code":"unauthorized","description":"User is not logged in"}}}
`

An alternative url could be:

https://query2.finance.yahoo.com/v8/finance/chart/AAPL?period1=1735599600&period2=1735686000&interval=1d&events=history

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions