Skip to content

Commit b3e5d38

Browse files
salty-horseparthea
andauthored
fix: Replace deprecated utcnow, utcfromtimestamp (#2286)
Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 79fee0e commit b3e5d38

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

googleapiclient/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
from googleapiclient import errors
7979

8080
# The unix time epoch starts at midnight 1970.
81-
EPOCH = datetime.datetime.utcfromtimestamp(0)
81+
EPOCH = datetime.datetime(1970, 1, 1)
8282

8383
# Map the names of the parameters in the JSON channel description to
8484
# the parameter names we use in the Channel class.

googleapiclient/discovery_cache/file_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
LOGGER = logging.getLogger(__name__)
4747

4848
FILENAME = "google-api-python-client-discovery-doc.cache"
49-
EPOCH = datetime.datetime.utcfromtimestamp(0)
49+
EPOCH = datetime.datetime(1970, 1, 1)
5050

5151

5252
def _to_timestamp(date):

tests/test_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2193,7 +2193,7 @@ def _dummy_token(self):
21932193
client_id = "some_client_id"
21942194
client_secret = "cOuDdkfjxxnv+"
21952195
refresh_token = "1/0/a.df219fjls0"
2196-
token_expiry = datetime.datetime.utcnow()
2196+
token_expiry = datetime.datetime.now(datetime.timezone.utc)
21972197
user_agent = "refresh_checker/1.0"
21982198
return OAuth2Credentials(
21992199
access_token,

0 commit comments

Comments
 (0)