[Python-modules-commits] [prawcore] 01/01: New upstream version 0.12.0
Josué Ortega
josue at moszumanska.debian.org
Sat Oct 28 20:54:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
josue pushed a commit to annotated tag upstream/0.12.0
in repository prawcore.
commit 6a9b8494d9bef7eb05a681b59574d2008aea6e34
Author: Josue Ortega <josue at debian.org>
Date: Sat Oct 28 14:28:58 2017 -0600
New upstream version 0.12.0
---
CHANGES.rst | 8 ++++++++
PKG-INFO | 2 +-
prawcore.egg-info/PKG-INFO | 2 +-
prawcore.egg-info/requires.txt | 2 +-
prawcore/const.py | 2 +-
prawcore/exceptions.py | 4 ++++
prawcore/sessions.py | 10 +++++++---
setup.py | 2 +-
8 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index eba6d09..d29caf7 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,14 @@ Change Log
prawcore follows `semantic versioning <http://semver.org/>`_ with the exception
that deprecations will not be announced by a minor release.
+0.12.0 (2017-08-30)
+-------------------
+
+**Added**
+
+* ``BadJSON`` exception for the rare cases that a response that should contain
+ valid JSON has unparsable JSON.
+
0.11.0 (2017-05-27)
-------------------
diff --git a/PKG-INFO b/PKG-INFO
index af01413..aa9255c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: prawcore
-Version: 0.11.0
+Version: 0.12.0
Summary: Low-level communication layer for PRAW 4+.
Home-page: https://github.com/praw-dev/prawcore
Author: Bryce Boe
diff --git a/prawcore.egg-info/PKG-INFO b/prawcore.egg-info/PKG-INFO
index af01413..aa9255c 100644
--- a/prawcore.egg-info/PKG-INFO
+++ b/prawcore.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: prawcore
-Version: 0.11.0
+Version: 0.12.0
Summary: Low-level communication layer for PRAW 4+.
Home-page: https://github.com/praw-dev/prawcore
Author: Bryce Boe
diff --git a/prawcore.egg-info/requires.txt b/prawcore.egg-info/requires.txt
index 33f749f..c9a9151 100644
--- a/prawcore.egg-info/requires.txt
+++ b/prawcore.egg-info/requires.txt
@@ -1 +1 @@
-requests >=2.6.0, <3.0
+requests<3.0,>=2.6.0
diff --git a/prawcore/const.py b/prawcore/const.py
index 8600769..35cb6cb 100644
--- a/prawcore/const.py
+++ b/prawcore/const.py
@@ -1,7 +1,7 @@
"""Constants for the prawcore package."""
import os
-__version__ = '0.11.0'
+__version__ = '0.12.0'
ACCESS_TOKEN_PATH = '/api/v1/access_token'
AUTHORIZATION_PATH = '/api/v1/authorize'
diff --git a/prawcore/exceptions.py b/prawcore/exceptions.py
index bc1d03b..735faa7 100644
--- a/prawcore/exceptions.py
+++ b/prawcore/exceptions.py
@@ -69,6 +69,10 @@ class OAuthException(PrawcoreException):
PrawcoreException.__init__(self, message)
+class BadJSON(ResponseException):
+ """Indicate the response did not contain valid JSON."""
+
+
class BadRequest(ResponseException):
"""Indicate invalid parameters for the request."""
diff --git a/prawcore/sessions.py b/prawcore/sessions.py
index 0de9731..68d29e5 100644
--- a/prawcore/sessions.py
+++ b/prawcore/sessions.py
@@ -10,8 +10,9 @@ from requests.status_codes import codes
from .auth import BaseAuthorizer
from .rate_limit import RateLimiter
-from .exceptions import (BadRequest, Conflict, InvalidInvocation, NotFound,
- Redirect, RequestException, ServerError, TooLarge)
+from .exceptions import (BadJSON, BadRequest, Conflict, InvalidInvocation,
+ NotFound, Redirect, RequestException, ServerError,
+ TooLarge)
from .util import authorization_error_class
log = logging.getLogger(__package__)
@@ -127,7 +128,10 @@ class Session(object):
'Unexpected status code: {}'.format(response.status_code)
if response.headers.get('content-length') == '0':
return ''
- return response.json()
+ try:
+ return response.json()
+ except ValueError:
+ raise BadJSON(response)
def _set_header_callback(self):
if not self._authorizer.is_valid() and hasattr(self._authorizer,
diff --git a/setup.py b/setup.py
index 6f7681a..6fad609 100644
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@ setup(name=PACKAGE_NAME,
'betamax_matchers >=0.4.0, <0.5',
'betamax-serializers >=0.2.0, <0.3',
'mock >=0.8, <3',
- 'testfixtures >4.13.2, <5'],
+ 'testfixtures >4.13.2, <6'],
test_suite='tests',
url='https://github.com/praw-dev/prawcore',
version=VERSION)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/prawcore.git
More information about the Python-modules-commits
mailing list