Skip to content

Commit

Permalink
Use UTC timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
TrishGillett committed Aug 11, 2024
1 parent 476f824 commit 7a168f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tap_github/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import time
from copy import deepcopy
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from os import environ
from random import choice, shuffle
from typing import Any, Dict, List, Optional, Set, Tuple
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(
def update_rate_limit(self, response_headers: Any) -> None:
self.rate_limit = int(response_headers["X-RateLimit-Limit"])
self.rate_limit_remaining = int(response_headers["X-RateLimit-Remaining"])
self.rate_limit_reset = datetime.fromtimestamp(
self.rate_limit_reset = datetime.utcfromtimestamp(
int(response_headers["X-RateLimit-Reset"])
)
self.rate_limit_used = int(response_headers["X-RateLimit-Used"])
Expand Down
4 changes: 2 additions & 2 deletions tap_github/tests/test_authenticator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, patch

import pytest
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_update_rate_limit(self):

assert token_manager.rate_limit == 5000
assert token_manager.rate_limit_remaining == 4999
assert token_manager.rate_limit_reset == datetime(2013, 7, 1, 11, 47, 53)
assert token_manager.rate_limit_reset == datetime(2013, 7, 1, 17, 47, 53)
assert token_manager.rate_limit_used == 1

def test_is_valid_token_successful(self):
Expand Down

0 comments on commit 7a168f9

Please sign in to comment.