## page was renamed from Requests = Requests = Requests is an Apache2 Licensed HTTP library, written in Python, for human beings. http://docs.python-requests.org/en/latest/ == Installation in Slackware == * easy_install requests # python3 * easy_install-2.7 requests or * easy_install pip * pip install requests Python3 test: {{{ $ python3 Python 3.4.0 (default, May 9 2014, 21:04:05) [GCC 4.7.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import requests >>> requests.__version__ '2.3.0' >>> quit() }}} Python 2.7 test: {{{ $ python2.7 Python 2.7.3 (default, Jul 3 2012, 21:16:07) [GCC 4.7.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import requests >>> requests.__version__ '2.3.0' >>> quit() }}} == Sample app in pyunit == {{{#!highlight python #filename: requestsTest.py #Run tests: python3 requestsTest.py import unittest import requests #import json class SimpleTestCase(unittest.TestCase): def setUp(self): self.geocodeurl='http://maps.googleapis.com/maps/api/geocode/json' def tearDown(self): pass def testCorroios(self): payload = {'address': 'Corroios', 'sensor': 'false'} r = requests.get(self.geocodeurl,params=payload) print( r.text ) self.assertEqual(True, len(r.text)>0 ) objx = r.json() #json.loads(r.text) self.assertEqual('2855-117 Corroios, Portugal' , objx['results'][0]['formatted_address'] ) def testAltoDoMoinho(self): payload = {'address': 'Alto do Moinho,Setubal', 'sensor': 'false'} r = requests.get(self.geocodeurl,params=payload) print( r.text ) self.assertEqual(True, len(r.text)>0 ) objx = r.json() #json.loads(r.text) self.assertEqual('Alto do Moinho, 2855, Portugal' , objx['results'][0]['formatted_address'] ) if __name__ == '__main__': unittest.main() }}}