Skip to content

Commit

Permalink
fix: Replace deprecated utcnow, utcfromtimestamp (#2286)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
salty-horse and parthea committed Dec 12, 2023
1 parent 79fee0e commit b3e5d38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion googleapiclient/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
from googleapiclient import errors

# The unix time epoch starts at midnight 1970.
EPOCH = datetime.datetime.utcfromtimestamp(0)
EPOCH = datetime.datetime(1970, 1, 1)

# Map the names of the parameters in the JSON channel description to
# the parameter names we use in the Channel class.
Expand Down
2 changes: 1 addition & 1 deletion googleapiclient/discovery_cache/file_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
LOGGER = logging.getLogger(__name__)

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


def _to_timestamp(date):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@ def _dummy_token(self):
client_id = "some_client_id"
client_secret = "cOuDdkfjxxnv+"
refresh_token = "1/0/a.df219fjls0"
token_expiry = datetime.datetime.utcnow()
token_expiry = datetime.datetime.now(datetime.timezone.utc)
user_agent = "refresh_checker/1.0"
return OAuth2Credentials(
access_token,
Expand Down

0 comments on commit b3e5d38

Please sign in to comment.