Skip to content

Conversation

@mahdi-saberi
Copy link

some websites have gzip enabled on their webservers!
e.g.
http://www.yjc.ir/fa/news/6072181/

so we need to have gzip decompressor

encoding = connection.headers['content-type'].lower().split('charset=')[-1]
if encoding.lower() == 'text/html':
encoding = chardet.detect(self.data)['encoding']
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gzip should only be invoked when we are sure that the data is actually compressed. You may want to check an appropriate header.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowadays lots and lots of websites are gzip
i added exception "pass" if it's not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants