Auth#
- class yfinance.Auth(session=None)#
Attributes
- user
Get the logged-in user’s details.
- Returns:
A dictionary containing the user’s details if logged in, or None if not logged in.
- Return type:
dict | None
Methods
- __init__(session=None)
- check_login() bool
Check whether the user is logged in to Yahoo Finance.
- set_login_cookies(cookie_t: str, cookie_y: str) None
Set the login cookies to indicate that the user is logged in.
- How to Obtain the Cookies:
Open your browser (e.g., Chrome, Firefox).
Log in to Yahoo Finance (https://finance.yahoo.com).
Open the browser’s Developer Tools: Press F12 or Ctrl + Shift + I (Windows/Linux) or Cmd + Option + I (Mac).
Go to the “Application” tab (Chrome) or “Storage” tab (Firefox).
In the “Cookies” section, select https://finance.yahoo.com.
Look for the cookies named T and Y.
Copy the values of these cookies and pass them to this function.
- Parameters:
cookie_t (str) – The value for the ‘T’ cookie.
cookie_y (str) – The value for the ‘Y’ cookie.
- check_login() bool#
Check whether the user is logged in to Yahoo Finance.
- set_login_cookies(cookie_t: str, cookie_y: str) None#
Set the login cookies to indicate that the user is logged in.
- How to Obtain the Cookies:
Open your browser (e.g., Chrome, Firefox).
Log in to Yahoo Finance (https://finance.yahoo.com).
Open the browser’s Developer Tools: Press F12 or Ctrl + Shift + I (Windows/Linux) or Cmd + Option + I (Mac).
Go to the “Application” tab (Chrome) or “Storage” tab (Firefox).
In the “Cookies” section, select https://finance.yahoo.com.
Look for the cookies named T and Y.
Copy the values of these cookies and pass them to this function.
- Parameters:
cookie_t (str) – The value for the ‘T’ cookie.
cookie_y (str) – The value for the ‘Y’ cookie.