Skip to content

Commit 1444de9

Browse files
Sameer on mactopAsk Solem
authored andcommitted
total_seconds is a 2.7 addition. saving a line does not seem worth forcing an upgrade
1 parent d7a1127 commit 1444de9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

github2/request.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def post(self, *path_components, **extra_post_data):
7171

7272
def make_request(self, path, extra_post_data=None, method="GET"):
7373
if self.delay:
74-
since_last = (datetime.datetime.now() - self.last_request
75-
).total_seconds()
76-
if since_last < self.delay:
77-
duration = self.delay - since_last
74+
since_last = (datetime.datetime.now() - self.last_request)
75+
since_last_in_seconds = since_last.days * 24 * 60 * 60 + since_last.seconds
76+
if since_last_in_seconds < self.delay:
77+
duration = self.delay - since_last_in_seconds
7878
if self.debug:
7979
sys.stderr.write("delaying API call %s\n" % duration)
8080
time.sleep(duration)

0 commit comments

Comments
 (0)