example-code icon indicating copy to clipboard operation
example-code copied to clipboard

Remove charset from CONTENT_TYPE from http_charfinder.py in chapter18

Open ResolveWang opened this issue 8 years ago • 2 comments

In the recent version of aiohttp(v2.x), the default value of charset is utf-8, if we use

CONTENT_TYPE = 'text/html; charset=UTF-8'

The code will raise the exception below

ValueError: charset must not be in content_type argument

This PR removes the charset since its default value is utf-8.

ResolveWang avatar Aug 06 '17 02:08 ResolveWang

Also, if using python 3.6+ need to change **vars(descr) to **descr._asdict()

ScottyNZ avatar Dec 30 '17 09:12 ScottyNZ

Thank you both for this contribution. I have not yet started working on a 2nd edition of Fluent Python. Almost all the issues (like this one) are related to breaking changes that happened in asyncio, which was a provisional package in Python 3.4 when I wrote the book. I have since fixed some of the asyncio examples that I use in talks or courses, only to seem them break again in the next release. So my current plan is to review your contributions only when I actually start working on the 2nd edition of the book. I appreciate your contributions and I will let you know when they are added to the new edition.

ramalho avatar Dec 30 '17 13:12 ramalho