Dear community, I am trying to download bonds information data from the govsrch using the following code:
# Define the start and end dates
start_date = '2025-01-01'
end_date = '2025-06-30'
# Generate a list of dates between the start and end dates
date_range = pd.date_range(start=start_date, end=end_date)
# Convert to a list of strings if needed
date_list_as_strings = [date.strftime('%Y-%m-%d') for date in date_range]
rd.get_config()["http.request-timeout"] = 400
rd.open_session()
df_tot = []
for t in date_list_as_strings:
response = search.Definition(
view = search.Views.GOV_CORP_INSTRUMENTS,
top = 10000,
filter = "((DbType eq 'CORP') and RCSAssetCategory eq 'A:J' and ((IssueDate ge "+t+" and IssueDate le "+t+")))",
navigators = "IssueDate(calc:sum_FaceIssuedUSD,calc:sum_FaceOutstandingUSD,calc:sum_FaceIssuedTotal,type:histogram,buckets:100)",
select = "IssuerOrgid,RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,FaceIssuedUSD,""FaceOutstandingUSD,IssueDate,CouponRate,MaturityDate,ISIN,RCSDomicileLeaf,RCSCountryOfIncorporationLeaf,DBSTicker,RCSDomicileGenealogy""IsESGBond,KPITypeDescription,IsGreenBond,MaturityStandardYield,InstrumentTypeDescription,IssuePrice,FaceIssuedTotal,CouponFrequencyDescription,RCSCurrencyLeaf""RCSBondGradeLeaf,RCSCoveredBondGenealogy,IsCallable,IsPutable,RCSUseOfProceedsLeaf,RCSCurrencyLeaf"
).get_data()
df=response.data.df
if t == start_date:
df_tot = df
else:
df_tot = df_tot.append(df)
print(t)
df_tot.shape[0]
but I am getting the error:
An error occurred while requesting URL('http://localhost:9000/api/rdp/discovery/search/v1/').ReadTimeout('timed out')
This error pops out not always at the same "t" when I relaunch the code.
Can anyone help me?
Thanks!