Похожие чаты

I want to check when a request was last made.

So if it was made a fewer than a minute ago, dont make it, else do so again to update. How can i do this? I have also found about timedelta, but i think i will need some integer that i can compare. How to do this?

1 ответов

5 просмотров

if you're the one making requests, then you could simply store the instant when you made the request in a variable. You could do this using the datetime library, like: from datetime import datetime last_req_time = datetime.now() then you can compare the times between last_req_time and datetime.now like if one_min_elapsed(last_req_time, datetime.now()): do_your_thing() I'll leave the implementation of one_min_elapsed to you

Похожие вопросы

Обсуждают сегодня

Карта сайта