Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (28 sloc) 1.14 KB
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('')
tinfoilhat.BlockedError: Host name 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('')
tinfoilhat.BlockedError: Host name is blocked
Author & License
This library was created by `Patrice Neff`_ for initial use at Memonic_. It's
licensed under the `BSD License`_.
.. _httplib2:
.. _LWPX::ParanoidAgent:
.. _Patrice Neff:
.. _Memonic:
.. _BSD License:
Jump to Line
Something went wrong with that request. Please try again.