Shouldn't that be something like:
```
if  'gzip' in r.info().get('Content-Encoding', ''):
```
In case there's some other stuff mentioned in that header.