Created
November 10, 2020 14:15
-
-
Save sertraline/800da255ab0c15ba0152023c19500074 to your computer and use it in GitHub Desktop.
chardet fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/psf/requests/issues/2359#issuecomment-552736992 | |
import requests | |
import cchardet | |
class ForceCchardet: | |
@property | |
def apparent_encoding(obj): | |
return cchardet.detect(obj.content)['encoding'] | |
requests.Response.apparent_encoding = ForceCchardet.apparent_encoding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment