0

一旦我发送了我的请求,它们就会立即返回,但似乎存在一个问题,即我在请求之间会突然出现随机延迟!?我真的要求不要拖延,寻找我能得到的所有帮助!

import requests 
from requests_oauthlib import OAuth1
import datetime

url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
auth = OAuth1(consumer_key1, consumer_secret1, access_token_key1, access_token_secret1)
requests.get(url, auth=auth)

while True:
    print(datetime.datetime.now())
    r = requests.get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=stackoverflow&count=1', auth=auth)
    print(datetime.datetime.now())```

2019-12-01 04:05:05.723679
2019-12-01 04:05:05.723679
2019-12-01 04:05:05.966036
2019-12-01 04:05:05.966036
2019-12-01 04:05:06.172799
2019-12-01 04:05:06.173329
2019-12-01 04:05:06.384113
2019-12-01 04:05:06.384113
2019-12-01 04:05:06.581163
2019-12-01 04:05:06.581163
2019-12-01 04:05:06.814331
2019-12-01 04:05:06.814331
2019-12-01 04:05:07.042689
2019-12-01 04:05:07.042689
4

0 回答 0