mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 15:06:53 +00:00
fixed markdown parsing bug
This commit is contained in:
parent
579421f4ab
commit
d26a3cfc78
@ -70,6 +70,15 @@ class IEX_Symbol:
|
||||
# Make sure API returned valid JSON
|
||||
try:
|
||||
resp_json = resp.json()
|
||||
print(type(resp_json))
|
||||
|
||||
# IEX uses backtick ` as apostrophe which breaks telegram markdown parsing
|
||||
if type(resp_json) is dict:
|
||||
print("Fixing format ` to '")
|
||||
resp_json["companyName"] = resp_json.get("companyName", "").replace(
|
||||
"`", "'"
|
||||
)
|
||||
|
||||
return resp_json
|
||||
except r.exceptions.JSONDecodeError as e:
|
||||
logging.error(e)
|
||||
@ -108,6 +117,9 @@ class IEX_Symbol:
|
||||
|
||||
symbols = pd.concat([reg, otc])
|
||||
|
||||
# IEX uses backtick ` as apostrophe which breaks telegram markdown parsing
|
||||
symbols["name"] = symbols["name"].str.replace("`", "'")
|
||||
|
||||
symbols["description"] = "$" + symbols["symbol"] + ": " + symbols["name"]
|
||||
symbols["id"] = symbols["symbol"]
|
||||
symbols["type_id"] = "$" + symbols["symbol"].str.lower()
|
||||
|
Loading…
x
Reference in New Issue
Block a user