简体   繁体   English

发出多个 API 请求,更新 dataframe -python

[英]Making multiple API requests, updating dataframe -python

I Would like to make a request every minute throughout the day, and would like to append this information to a dataframe我想全天每分钟发一个请求,并想把 append 这个信息发给 dataframe

I would like to be able to access this dataframe我希望能够访问这个 dataframe

Could you please point me to certain modules to use.您能否指出我要使用的某些模块。

I tried using schedule, but i can't seem to access the dataframe as it is running.我尝试使用计划,但我似乎无法在 dataframe 运行时访问它。

Perhaps a threading.Timer is what you're looking for.也许你正在寻找一个threading.Timer

import threading

def my_updating_function(df, request_args):
    ...  # homework for the asker

t = threading.Timer(
    60,
    my_updating_function,
    args=(df, request_args),
)
t.start()

Note your design may cause trouble if this is within a web API请注意,如果这是在 web API 内,您的设计可能会导致问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM