Skip to content

Commit e6368a5

Browse files
authored
fix: Encryption samples no logner break with new requests library version (GoogleCloudPlatform#6464)
## Description Fixes the code that was failing with new version of requests library, as evident in GoogleCloudPlatform#6422 ## Checklist - [x] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md) - [x] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#readme-file) - [x] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [x] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [x] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/CODEOWNERS) with the codeowners for this sample
1 parent c7375e5 commit e6368a5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compute/encryption/generate_wrapped_rsa_key.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_google_public_cert_key():
4242

4343
# Load the certificate.
4444
certificate = x509.load_pem_x509_certificate(
45-
r.text.encode('utf-8'), default_backend())
45+
r.content, default_backend())
4646

4747
# Get the certicate's public key.
4848
public_key = certificate.public_key()

compute/encryption/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cryptography==3.4.7
2-
requests==2.25.1
2+
requests==2.26.0
33
google-api-python-client==2.12.0
44
google-auth==1.31.0
55
google-auth-httplib2==0.1.0

0 commit comments

Comments
 (0)