googleapis / googleapis/google-cloud-python

DeprecationWarning when getting user credentials

Đang mở
#15,589 1 bình luận 1 reaction 1 người được giao Được @andyrzhao nhận Xem trên GitHub
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

#### Environment details

- Python version: 3.12
- `google-auth-oauthlib` version: 1.2.4

#### Steps to reproduce

1. Execute the `get_user_credentials` function

#### Code example

```python
credentials = get_user_credentials(
scopes=scopes,
client_id=client_secrets['client_id'],
client_secret=client_secrets['client_secret'],
)
```

#### Stack trace
```
> credentials.expiry = datetime.datetime.utcfromtimestamp(session.token["expires_at"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).

.../lib/python3.12/site-packages/google_auth_oauthlib/helpers.py:150: DeprecationWarning

```

The issue is here: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/main/google_auth_oauthlib/helpers.py#L150, the `datetime.utcfromtimestamp` is deprecated since Python 3.12 (see https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.