mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-05 00:42:19 +00:00
* Add exception to http requests made by ftd * Formatting Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
from urllib.error import HTTPError
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
@@ -170,16 +171,20 @@ def get_fails_to_deliver(
|
||||
ftd_urls = catching_diff_url_formats(ftd_urls)
|
||||
|
||||
for ftd_link in ftd_urls:
|
||||
all_ftds = pd.read_csv(
|
||||
ftd_link,
|
||||
compression="zip",
|
||||
sep="|",
|
||||
engine="python",
|
||||
skipfooter=2,
|
||||
usecols=[0, 2, 3, 5],
|
||||
dtype={"QUANTITY (FAILS)": "Int64"},
|
||||
encoding="iso8859",
|
||||
)
|
||||
try:
|
||||
all_ftds = pd.read_csv(
|
||||
ftd_link,
|
||||
compression="zip",
|
||||
sep="|",
|
||||
engine="python",
|
||||
skipfooter=2,
|
||||
usecols=[0, 2, 3, 5],
|
||||
dtype={"QUANTITY (FAILS)": "Int64"},
|
||||
encoding="iso8859",
|
||||
)
|
||||
except HTTPError:
|
||||
continue
|
||||
|
||||
tmp_ftds = all_ftds[all_ftds["SYMBOL"] == symbol]
|
||||
del tmp_ftds["PRICE"]
|
||||
del tmp_ftds["SYMBOL"]
|
||||
|
||||
Reference in New Issue
Block a user