So I have the following program:
client = Socrata("www.datos.gov.co", None)
# Example authenticated client (needed for non-public datasets):
# client = Socrata(www.datos.gov.co,
# MyAppToken,
# userame="[email protected]",
# password="AFakePassword")
# First results, returned as JSON from API / converted to Python list of
# dictionaries by sodapy.
results = client.get("gt2j-8ykr", limit=800000)
# Convert to pandas DataFrame
results_df = pd.DataFrame.from_records(results)
now, every time I run the code the variable 'results' has a new updated value as expectedly and so does the dataframe 'results_df'. What I want to do is to save all GET requests my program does (to be more precise I just want the len(results_df)). Some people have suggested me to make a list and append len(results_df). But, that obviously does not work as it just appends the current value of len(results_df), it does not save the previous value of len(results_df) so every time I run the code I end up with a list containing the current single value of len(results_df). But, what I want is the list to save the previous values of len(results_df) of previous program executions.
Im sorry if this a silly question but Im new to coding and I could not find any solution anywhere. Thanks
Use a persistent file storage and store the result length on disc:
and then use
Example:
to get a file with