alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 375 forks source link

ERR#0093 Please provide more information for this error to help debuging #487

Open sine-w opened 2 years ago

sine-w commented 2 years ago

Hello, I have a file to do lots of search using the search module, and one of them return the following error msg.

raise RuntimeError("ERR#0093: no results found on Investing.com for the introduced text.")

looking at this error message, I dont know which piece of text the error message is referring to. Can you please make it something like raise RuntimeError(f"ERR#0093: no results found on Investing.com for the {introduced text}.")

mesoclever commented 2 years ago

Try try:

import investpy

# get list object containing all stocks
stock_list = investpy.get_stocks_list('south africa')

# insert bogus stock to test
stock_list.insert(3,'XXXX')

for stock in stock_list:
    try:
        search_result = investpy.search_quotes(text=stock, products=["stocks"], countries=["south africa"], n_results=1)
        information = search_result.retrieve_information()
        print(stock + ' success')
    except Exception as e:
        print(stock + 'error: ' + str(e))
        continue
sine-w commented 2 years ago

Hello, Thanks. Yes I found out what causes the error But I dont know what is wrong here investpy.search_quotes(text='China 10-Year Bond Yield', n_results=1)

the text 'China 10-Year Bond Yield' is directly copied from investing.com, but why it produce error here? page:https://www.investing.com/rates-bonds/china-10-year-bond-yield

mesoclever commented 2 years ago

I dont know much about bonds, maybe check the spelling.

>>> bond_df = investpy.bonds.get_bonds(country='China')
>>> print(bond_df)
  country       name      full_name
0   china  China 10Y  China 10-Year
1   china  China 20Y  China 20-Year
2   china  China 15Y  China 15-Year
3   china   China 7Y   China 7-Year
4   china  China 30Y  China 30-Year
5   china   China 3Y   China 3-Year
6   china   China 2Y   China 2-Year
7   china   China 1Y   China 1-Year
8   china   China 5Y   China 5-Year
>>> search_result = investpy.search_quotes(text='China 10-Year',n_results=1)
>>> print(search_result)
{"id_": 1164528, "name": "UBS(Lux)Fund Solutions \u2013 J.P. Morgan CNY China Government 1-10 Year Bond UCITS ETF(USD)A-acc", "symbol": "JC11", "country": "germany", "tag": "/etfs/cib?cid=1164528", "pair_type": "etfs", "exchange": "Xetra"}
sine-w commented 2 years ago

Ok thanks let me try again