Skip to main content

httplib2 extension that is more paranoid about input

Project description

TinfoilHat is a httplib2 extension that is more paranoid about input. It won’t allow downloading data from private IP ranges.

This library was inspired by, but is not yet as paranoid as, Perl’s LWPx::ParanoidAgent.

Example usage

TinfoilHat is a drop-in replacement for httplib2:

>>> import tinfoilhat
>>> client = tinfoilhat.Http()
>>> client.request('http://0.1.2.3/')
...
tinfoilhat.BlockedError: Host name 0.1.2.3 is blocked

You can also specify an additional blacklist as a list of regular expressions:

>>> import tinfoilhat
>>> client = tinfoilhat.Http(blacklist=['83\.\d+\.\d+\.\d+'])
>>> client.request('http://83.5.6.7')
...
tinfoilhat.BlockedError: Host name 83.5.6.7 is blocked

Author & License

This library was created by Patrice Neff for initial use at Memonic. It’s licensed under the BSD License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for TinfoilHat, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size TinfoilHat-0.3.zip (6.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page