How do i send request at specific ms in python

Viewed 65

Hello i am trying to send a request to a url at a specific time i wrote this

import datetime
import time
from threading import Timer
import requests


def job():
    requests.get('https://www.weather.org')
    print(datetime.datetime.now())


x=datetime.datetime.today()
y = x.replace(day=x.day, hour=21, minute=1, second=59, microsecond=10)
delta_t=y-x
secs = delta_t.seconds+1
Timer(secs,job).start()

However when i run it prints2022-03-30 21:02:00.282179 when it is supposed to print 10ms after any answers on why this is happening?

0 Answers
Related