googleapis / googleapis/google-api-python-client

ERROR: 'OpenSSL.crypto' has no attribute 'sign'

オープン
#2,554 コメント 8 件 リアクション 22 件 担当者 1 名 @chalmerlowe に割り当て済み GitHub で見る
priority: p3 type: bug
主要言語
Python
スター
8.9k
フォーク
2.6k
平均マージ
2日 28分
マージ済み PR(30日)
17

説明

#### Environment details

- OS type and version: ubuntu:20.04 and macOs 14.7.1
- Python version: 3.11
- pip version: I dont use pip y use Poetry 1.5.1
- `google-api-python-client` version: 2.159.0

#### Steps to reproduce

1. Install google-api-python-client with pip, pdm, poetry, hatch... it doesn't matter
2. Use the method oauth to authenticate
`from oauth2client.service_account import ServiceAccountCredentials`
3. use .execute() method of any googleapi method
4. this retrieves the error 'OpenSSL.crypto' has no attribute 'sign'

#### Why does this happen?

Because you are importing oauth2client on the line https://github.com/googleapis/google-api-python-client/blob/main/googleapiclient/_auth.py#L33 and it is deprecated, oauth2client uses [openssl](https://github.com/pyca/pyopenssl) with the method [sign](https://github.com/googleapis/oauth2client/blob/master/oauth2client/_openssl_crypt.py#L97) and openssl removed the method sign on the version [24.3.0](https://github.com/pyca/pyopenssl/blob/main/CHANGELOG.rst#backward-incompatible-changes-1).

So if you install openssl >= 24.3.0, and if you use the oauth2client.service_account from googleapiclient this will retrieves you the error

` ERROR: module 'OpenSSL.crypto' has no attribute 'sign' `

#### How to solves this?

Set a constraint of openssl >= 24.3.0 on googleapiclient or dont import oauth2client on googleapi anymore.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。