Bot #174

Merged
Rripped merged 4 commits from bot into main 2022-05-12 06:40:28 +00:00
Showing only changes of commit 11e856db24 - Show all commits

View File

@ -106,8 +106,16 @@ def get_share_information(str_search_for):
return str_return
def get_share_information_markdown(str_search_for):
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
try:
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
except RuntimeError as e:
return hf.make_markdown_proof(f"no shares found for \"{str_search_for}\"") # if no shares are found, make error message markdown proof and return
except ConnectionError as e:
return hf.make_markdown_proof(f"connection not possible. Try again later.") # if no connection, make error message markdown proof and return
str_return = f'*{hf.make_markdown_proof(search_result.name)}*\n_{hf.make_markdown_proof(search_result.symbol)}_\nworth: {hf.make_markdown_proof(get_share_price(str_search_for))}'
return str_return