Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
  • Loading branch information
kennethreitz committed Mar 21, 2018
1 parent 30b59cc commit 122b42a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 1 addition & 7 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

requests = "*"
pyquery = "*"
fake-useragent = "*"
parse = "*"
"bs4" = "*"
"w3lib" = "*"
pyppeteer = "*"

"rfc3986" = "*"

[dev-packages]

twine = "*"
requests-file = "*"
pytest = "*"
Expand All @@ -27,7 +23,5 @@ mypy = "*"
pytest-asyncio = "*"
psutil = "*"


[scripts]

tests = "pytest -v -m ok"
10 changes: 9 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions requests_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ def encoding(self) -> _Encoding:
# Scan meta tags for charset.
if self._html:
self._encoding = html_to_unicode(self.default_encoding, self._html)[0]
# Fall back to requests' detected encoding if decode fails.
try:
self.raw_html.decode(self.encoding)
except UnicodeDecodeError:
self._encoding = self.default_encoding


return self._encoding if self._encoding else self.default_encoding

Expand Down

0 comments on commit 122b42a

Please sign in to comment.