Skip to content

Conversation

@adamchainz
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #892 🦕

@adamchainz adamchainz requested review from a team as code owners March 14, 2023 10:56
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: storage Issues related to the googleapis/python-storage API. labels Mar 14, 2023
@adamchainz
Copy link
Contributor Author

Comparison of the two approaches:

>>> import cgi <stdin>:1: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 >>> from email.message import Message >>> content_type = 'text/plain; charset=utf-8; other=something' >>> cgi.parse_header(content_type)[1] {'charset': 'utf-8', 'other': 'something'} >>> message = Message(); message['content-type'] = content_type; dict(message.get_params()[1:]) {'charset': 'utf-8', 'other': 'something'} 
@adamchainz adamchainz changed the title Fix cgi DeprecationWarning fix: remove use of deprecated cgi module Mar 14, 2023
@adamchainz
Copy link
Contributor Author

Moved to HeaderParser, checked for equivalence on shell again:

>>> from email.parser import HeaderParser >>> content_type = 'text/plain; charset=utf-8; other=something' >>> msg = HeaderParser().parsestr("Content-Type: " + content_type) >>> dict(msg.get_params()[1:]) {'charset': 'utf-8', 'other': 'something'} 
@andrewsg andrewsg added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 28, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 28, 2023
@andrewsg
Copy link
Contributor

Thank you for doing this! I'll have the tests run against this branch and we'll go from there.

@andrewsg andrewsg added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 28, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 28, 2023
@andrewsg
Copy link
Contributor

Thank you!

@andrewsg andrewsg merged commit 3071832 into googleapis:main Mar 29, 2023
@adamchainz adamchainz deleted the fix_cgi_warning branch April 27, 2023 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/python-storage API. size: xs Pull request size is extra small.

4 participants