Added instructions and sample code for using requests over Tor

Added instructions and sample code for using requests over the Tor network.

Sample code shows how to verify a successful connection and how to connect to a hidden service.  Example sites are https://check.torproject.org/ and http://ic6au7wa3f6naxjq.onion/ (www.gnupg.org).


This is great work @Hasimir! I really appreciate your effort in putting this together.

Personally, I think this is better suited to a blog post and not the documentation. I'll leave this open, though, until @Lukasa wakes up. :)


No reason why it can't be both.  ;)

Besides, it's merely a conversion (well, more basic version) of some existing scripts I use to make sure my website is visible beyond my home network.  I've also got some Twython scripts using it, though more as an exercise to see if it'd work (it did).  I figured I may as well share.

And the advantage of adding it to the docs is the new users who will encounter requests months and even years down the track, when a blog entry is ancient history.


This is brilliant, @Hasimir! Unfortunately, I don't think it belongs in the documentation. =)

Requests documentation doesn't really contain 'recipes', or pre-canned instructions for how to do specific things. This is for two reasons: firstly, they add greatly to the (already not inconsiderable) size of the docs; and secondly, they then become something that needs to be actively maintained. This is harder for recipes like this one because they depend on external projects, meaning that if those projects change our documentation becomes out of date with no real way for us to spot it.

I agree that a blog post is a good idea. You'll also find that a good blog post providing a tutorial on using Requests in a certain way has a tendency to move up quite high in the Google listings. As two examples from my own blog, the specific search ["force ssl version python requests"](https://www.google.co.uk/search#q=force+ssl+version+python+requests) has my blog post as the top entry, and even the fairly general ["proxies python requests"](https://www.google.co.uk/search#q=proxies+python+requests) has my blog post on the front page. This is really where the information you've provided should belong. =)


You do make an excellent point regarding the code maintenance and the rest, I shall withdraw this and redirect it elsewhere.  Probably my own repo of assorted requests and Twython stuff.  Rewriting it as a part of a blog post or similar is probably the better course of action.  I shall withdraw the pull request and torment my poor little wordpress installation a bit later.


@Hasimir Do send me and @sigmavirus24 tweets when you write it and we'll make sure we RT and talk about your blog post lots. =D


Will do, just followed the pair of you (my account is easy to spot, it uses my real name and the same profile image ... and involvement in a certain party, but you'll see that soon enough).  Presumably such a post will get a little more traction than my last geeky post (I made yet another software license ... I was bored and it's short).

Anyway, aside from the requests over Tor thing I've also got a method of securing all those API passwords and tokens, even if you have to leave some of them lying around on disk.  From my very brief look at the session module in Ian's github3.py I suspect that might be well received too and it's really quite simple.  My code is aimed at the Twitter API and Twython, of course, but should be able to be ported without too much trouble.