Repository: ranaroussi/yfinance

Issue:
ISIN in .info returns 404
### Describe bug

Running .info with the ISIN as parameter returns a 404. Symbol works, ISIN does not.

### Simple code that reproduces your problem



```         
ticker_yahoo = yf.Ticker("US0079031078")
ticker_info = ticker_yahoo.info
print(ticker_info)
```
returns:
HTTPError: 404 Client Error: Not Found for url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078?modules=financialData%2CquoteType%2CdefaultKeyStatistics%2CassetProfile%2CsummaryDetail&ssl=true&crumb=nkKfTFXt4wT


### Debug log
```
DEBUG    get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
DEBUG    Entering get()
DEBUG     url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
DEBUG     params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'ssl': 'true'}
DEBUG     Entering _get_cookie_and_crumb()
DEBUG      cookie_mode = 'basic'
DEBUG      Entering _get_cookie_and_crumb_basic()
DEBUG       loaded persistent cookie
DEBUG       reusing cookie
DEBUG       crumb = 'nkKfTFXt4wT'
DEBUG      Exiting _get_cookie_and_crumb_basic()
DEBUG     Exiting _get_cookie_and_crumb()
DEBUG     toggling cookie strategy csrf -> basic
DEBUG     Entering _get_cookie_and_crumb()
DEBUG      cookie_mode = 'basic'
DEBUG      Entering _get_cookie_and_crumb_basic()
DEBUG       loaded persistent cookie
DEBUG       reusing cookie
DEBUG       crumb = 'nkKfTFXt4wT'
DEBUG      Exiting _get_cookie_and_crumb_basic()
DEBUG     Exiting _get_cookie_and_crumb()
DEBUG    Exiting get()
```
### Bad data proof

_No response_

### `yfinance` version

0.2.32

### Python version

3.11

### Operating system

_No response_


Discussion:
Your debug log is messy, it should look like this:
```
DEBUG    get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
DEBUG    Entering get()
DEBUG     url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
DEBUG     params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'ssl': 'true'}
DEBUG     Entering _get_cookie_and_crumb()
DEBUG      cookie_mode = 'basic'
...
```

Post if you figure out why your log is different.
> Your debug log is messy, it should look like this:
> 
> ```
> DEBUG    get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
> DEBUG    Entering get()
> DEBUG     url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/US0079031078
> DEBUG     params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'ssl': 'true'}
> DEBUG     Entering _get_cookie_and_crumb()
> DEBUG      cookie_mode = 'basic'
> ...
> ```
> 
> Post if you figure out why your log is different.

Happened because I'm using the library in a Jupyter notebook. Ran it in a new python script, main post has been edited with the clean log format. My apologies.
I see a problem, it never invoked the `csrf` cookie method.

Resolving patch:
diff --git a/yfinance/data.py b/yfinance/data.py
--- a/yfinance/data.py
+++ b/yfinance/data.py
@@ -99,7 +99,6 @@ def _set_cookie_strategy(self, strategy, have_lock=False):
             self._cookie_lock.acquire()
 
         try:
-            self._cookie_strategy = strategy
             if self._cookie_strategy == 'csrf':
                 utils.get_yf_logger().debug(f'toggling cookie strategy {self._cookie_strategy} -> basic')
                 self._session.cookies.clear()
@@ -203,6 +202,7 @@ def _get_crumb_basic(self, proxy=None, timeout=30):
             crumb_response = self._session.get(**get_args)
         self._crumb = crumb_response.text
         if self._crumb is None or '<html>' in self._crumb:
+            utils.get_yf_logger().debug("Didn't receive crumb")
             return None
 
         utils.get_yf_logger().debug(f"crumb = '{self._crumb}'")
@@ -215,7 +215,7 @@ def _get_cookie_and_crumb_basic(self, proxy, timeout):
         return cookie, crumb
 
     def _get_cookie_csrf(self, proxy, timeout):
-        if utils.reuse_cookie and self._cookie is not None:
+        if self._cookie is not None:
             utils.get_yf_logger().debug('reusing cookie')
             return True
 
@@ -239,6 +239,7 @@ def _get_cookie_csrf(self, proxy, timeout):
         soup = BeautifulSoup(response.content, 'html.parser')
         csrfTokenInput = soup.find('input', attrs={'name': 'csrfToken'})
         if csrfTokenInput is None:
+            utils.get_yf_logger().debug('Failed to find "csrfToken" in response')
             return False
         csrfToken = csrfTokenInput['value']
         utils.get_yf_logger().debug(f'csrfToken = {csrfToken}')
@@ -299,6 +300,7 @@ def _get_crumb_csrf(self, proxy=None, timeout=30):
         self._crumb = r.text
 
         if self._crumb is None or '<html>' in self._crumb or self._crumb == '':
+            utils.get_yf_logger().debug("Didn't receive crumb")
             return None
 
         utils.get_yf_logger().debug(f"crumb = '{self._crumb}'")
@@ -363,6 +365,7 @@ def get(self, url, user_agent_headers=None, params=None, proxy=None, timeout=30)
             'headers': user_agent_headers or self.user_agent_headers
         }
         response = self._session.get(**request_args)
+        utils.get_yf_logger().debug(f'response code={response.status_code}')
         if response.status_code >= 400:
             # Retry with other cookie strategy
             if strategy == 'basic':
@@ -374,6 +377,7 @@ def get(self, url, user_agent_headers=None, params=None, proxy=None, timeout=30)
             if strategy == 'basic':
                 request_args['cookies'] = {cookie.name: cookie.value}
             response = self._session.get(**request_args)
+            utils.get_yf_logger().debug(f'response code={response.status_code}')
 
         return response
 


Test patch: