From 6bde9551709444a9b3859ae33b6174edcc99b03e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 04:39:53 -0500 Subject: [PATCH 01/15] Python 2.5 Fixes. --- requests/__init__.py | 7 +++++-- requests/core.py | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/requests/__init__.py b/requests/__init__.py index b6e3841f..5c84046b 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- -from . import packages -from .core import * +import packages +from core import * + + + diff --git a/requests/core.py b/requests/core.py index cd2e764c..1de47c10 100644 --- a/requests/core.py +++ b/requests/core.py @@ -177,7 +177,7 @@ class Request(object): self._build_response(resp) self.response.ok = True - except urllib2.HTTPError as why: + except urllib2.HTTPError, why: self._build_response(why) self.response.error = why @@ -209,7 +209,7 @@ class Request(object): self._build_response(resp) self.response.ok = True - except urllib2.HTTPError as why: + except urllib2.HTTPError, why: self._build_response(why) self.response.error = why @@ -242,7 +242,7 @@ class Request(object): self._build_response(resp) self.response.ok = True - except urllib2.HTTPError as why: + except urllib2.HTTPError, why: self._build_response(why) self.response.error = why From 4419e7183f07cd5a5123b6e193e841f9a2ab3907 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 04:41:34 -0500 Subject: [PATCH 02/15] no more test suite --- test_suite.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 test_suite.sh diff --git a/test_suite.sh b/test_suite.sh deleted file mode 100755 index 86f8cd30..00000000 --- a/test_suite.sh +++ /dev/null @@ -1,4 +0,0 @@ -tox -coverage xml -rm -fr pylint.txt -pylint -d W0312 -d W0212 -d E1101 -d E0202 -d W0102 -d E0102 -f parseable ./requests > pylint.txt || true From 7e20f32b02f3ee50408118bef3ea269e7769be80 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 04:41:42 -0500 Subject: [PATCH 03/15] pypy configuration --- tox.ini | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 7c7d8552..388d6f9b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,11 @@ [tox] -envlist = py24,py25,py26,py27 +envlist = py24,py25,py26,py27,pypy [testenv] commands=py.test --junitxml=junit-{envname}.xml deps = - pytest \ No newline at end of file + pytest + +[testenv:pypy] +basepython=/usr/bin/pypy-c + From a7c87edebe395416571ad9cac7a37e2a8122b31d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 15:57:50 -0500 Subject: [PATCH 04/15] screw 2.4 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 388d6f9b..4999d6a5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py24,py25,py26,py27,pypy +envlist = py25,py26,py27,pypy [testenv] commands=py.test --junitxml=junit-{envname}.xml From b82e72eb04156f269aa393b1805e7d9de48f6b62 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 16:00:34 -0500 Subject: [PATCH 05/15] cStringIO fix. --- test_requests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test_requests.py b/test_requests.py index 7ea35343..963abbc1 100644 --- a/test_requests.py +++ b/test_requests.py @@ -2,7 +2,11 @@ # -*- coding: utf-8 -*- import unittest -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO import requests From fbe0393eb34e975022cd3bf884dc94a6f5aa886d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 16:08:26 -0500 Subject: [PATCH 06/15] cstring io fix for py3 --- test_requests.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test_requests.py b/test_requests.py index 963abbc1..a45f5cb2 100644 --- a/test_requests.py +++ b/test_requests.py @@ -1,12 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import sys import unittest -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO +if sys.version_info >= (3,0): + from io import StringIO +else: + try: + from cStringIO import StringIO + except ImportError: + from StringIO import StringIO import requests From e8234a013752ee8bae05c142d1950023c4a9fa8b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 18 Feb 2011 16:13:49 -0500 Subject: [PATCH 07/15] import fix --- requests/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/requests/__init__.py b/requests/__init__.py index 5c84046b..829a9572 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- -import packages -from core import * +from __future__ import absolute_import + +from . import packages +from .core import * From 8eafb8d3dfd9ead6e9f02f9854ef46720d712cb0 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 00:37:33 -0500 Subject: [PATCH 08/15] Added autoauth tests --- test_requests.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test_requests.py b/test_requests.py index a45f5cb2..e365c6ef 100644 --- a/test_requests.py +++ b/test_requests.py @@ -1,17 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import sys import unittest -if sys.version_info >= (3,0): - from io import StringIO -else: - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - import requests @@ -57,6 +48,16 @@ class RequestsTestSuite(unittest.TestCase): self.assertEqual(r.status_code, 200) + requests.add_autoauth(url, auth) + + r = requests.get(url) + self.assertEqual(r.status_code, 200) + + # reset auto authentication + requests.AUTOAUTHS = [] + + + def test_POSTBIN_GET_POST_FILES(self): bin = requests.post('http://www.postbin.org/') @@ -65,7 +66,7 @@ class RequestsTestSuite(unittest.TestCase): post = requests.post(bin.url, data={'some': 'data'}) self.assertEqual(post.status_code, 201) - post2 = requests.post(bin.url, files={'some': StringIO('data')}) + post2 = requests.post(bin.url, files={'some': open('test_requests.py')}) self.assertEqual(post2.status_code, 201) From 5072399f7af38ab14d638838a5e45818ca9ede41 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 00:41:28 -0500 Subject: [PATCH 09/15] Import fix for python2.5 --- requests/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/requests/__init__.py b/requests/__init__.py index 829a9572..5c84046b 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import - -from . import packages -from .core import * +import packages +from core import * From b5c2806e8c656332ad3664f14a3364d192214d81 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 00:43:27 -0500 Subject: [PATCH 10/15] Roadmap update --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 325c69ca..9fc05afd 100644 --- a/README.rst +++ b/README.rst @@ -140,8 +140,10 @@ If you'd like to contribute, simply fork `the repository`_, commit your changes Roadmap ------- -- Sphinx Documentation -- Exhaustive Unittests +- Sphinx Documentation (http://code.kennethreitz.com/requests/) +- Exhaustive unit tests +- Get rid of Poster (gets really nasty in py3.x) +- Python 3.x Support .. _`the repository`: http://github.com/kennethreitz/requests .. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS From f66b35454ff156534675fa6c51d93d3046217496 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 00:59:56 -0500 Subject: [PATCH 11/15] v0.2.4 Release information --- HISTORY.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 0b60fb1b..62fff1e9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,14 @@ History ------- +0.2.4 (2011-02-15) +++++++++++++++++++ + +* Python 2.5 Support +* PyPy-c v1.4 Support +* Auto-Authentication tests +* Improved Request object constructor + 0.2.3 (2011-02-15) ++++++++++++++++++ From a34e0bea8beb9f19706d751adbaa4f1c9234b37f Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 01:00:03 -0500 Subject: [PATCH 12/15] Version Bump (v0.2.4) --- requests/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requests/core.py b/requests/core.py index 1de47c10..9292a9a6 100644 --- a/requests/core.py +++ b/requests/core.py @@ -34,8 +34,8 @@ from .packages.poster.streaminghttp import register_openers __title__ = 'requests' -__version__ = '0.2.3' -__build__ = 0x000203 +__version__ = '0.2.4' +__build__ = 0x000204 __author__ = 'Kenneth Reitz' __license__ = 'ISC' __copyright__ = 'Copyright 2011 Kenneth Reitz' From 433452f9f147ce14dae0389c46a2f35ea4be9e30 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 01:01:51 -0500 Subject: [PATCH 13/15] Simpler setup.py versioning. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4df796ea..0e7fb94c 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ import os import sys +import requests from distutils.core import setup @@ -22,7 +23,7 @@ required = [] setup( name='requests', - version='0.2.3', + version=requests.__version__, description='Awesome Python HTTP Library that\'s actually usable.', long_description=open('README.rst').read() + '\n\n' + open('HISTORY.rst').read(), From d2584ff853c2cc319daa5ad5e93486f96c595d0e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 01:02:01 -0500 Subject: [PATCH 14/15] Production Ready! Added Python 2.5 to Support list. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0e7fb94c..edf89f1d 100644 --- a/setup.py +++ b/setup.py @@ -38,12 +38,12 @@ setup( install_requires=required, license='ISC', classifiers=( - # 'Development Status :: 5 - Production/Stable', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Natural Language :: English', 'License :: OSI Approved :: ISC License (ISCL)', 'Programming Language :: Python', - # 'Programming Language :: Python :: 2.5', + 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', # 'Programming Language :: Python :: 3.0', From 720d0b2c38bd5c8dcc03a1a1de23a976c76f5f87 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 19 Feb 2011 01:02:13 -0500 Subject: [PATCH 15/15] Version needs to be available externally. --- requests/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requests/__init__.py b/requests/__init__.py index 5c84046b..d44b2667 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -3,5 +3,4 @@ import packages from core import * - - +from core import __version__