mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Merge branch 'master' into develop
This commit is contained in:
@@ -10,6 +10,11 @@ PyGithub is stable. I will maintain it up to date with the API, and fix bugs if
|
||||
What's new?
|
||||
===========
|
||||
|
||||
Version 1.12.2 (March 3rd, 2013)
|
||||
--------------------------------
|
||||
|
||||
* `Fix <https://github.com/jacquev6/PyGithub/issues/142>`_ major issue with Python 3: Json decoding was broken. Thank you `bilderbuchi <https://github.com/bilderbuchi>`_ for reporting
|
||||
|
||||
Version 1.12.1 (February 20th, 2013)
|
||||
------------------------------------
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@ Change log
|
||||
Stable versions
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Version 1.12.2 (March 3rd, 2013)
|
||||
--------------------------------
|
||||
|
||||
* `Fix <https://github.com/jacquev6/PyGithub/issues/142>`_ major issue with Python 3: Json decoding was broken. Thank you `bilderbuchi <https://github.com/bilderbuchi>`_ for reporting
|
||||
|
||||
Version 1.12.1 (February 20th, 2013)
|
||||
------------------------------------
|
||||
|
||||
|
||||
+13
-4
@@ -40,6 +40,11 @@ class Requester:
|
||||
cls.__httpConnectionClass = httpConnectionClass
|
||||
cls.__httpsConnectionClass = httpsConnectionClass
|
||||
|
||||
@classmethod
|
||||
def resetConnectionClasses(cls):
|
||||
cls.__httpConnectionClass = httplib.HTTPConnection
|
||||
cls.__httpsConnectionClass = httplib.HTTPSConnection
|
||||
|
||||
def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent):
|
||||
if password is not None:
|
||||
login = login_or_token
|
||||
@@ -91,6 +96,8 @@ class Requester:
|
||||
if len(data) == 0:
|
||||
return None
|
||||
else:
|
||||
if atLeastPython3 and isinstance(data, bytes): # pragma no branch
|
||||
data = data.decode("utf-8") # pragma no cover
|
||||
return json.loads(data)
|
||||
|
||||
def requestJson(self, verb, url, parameters, input):
|
||||
@@ -192,10 +199,12 @@ class Requester:
|
||||
return url + "?" + urllib.urlencode(parameters)
|
||||
|
||||
def __createConnection(self):
|
||||
if atLeastPython26:
|
||||
return self.__connectionClass(host=self.__hostname, port=self.__port, strict=True, timeout=self.__timeout)
|
||||
else: # pragma no cover
|
||||
return self.__connectionClass(host=self.__hostname, port=self.__port, strict=True) # pragma no cover
|
||||
kwds = {}
|
||||
if not atLeastPython3: # pragma no branch
|
||||
kwds["strict"] = True # Useless in Python3, would generate a deprecation warning
|
||||
if atLeastPython26: # pragma no branch
|
||||
kwds["timeout"] = self.__timeout # Did not exist before Python2.6
|
||||
return self.__connectionClass(host=self.__hostname, port=self.__port, **kwds)
|
||||
|
||||
def __log(self, verb, url, requestHeaders, input, status, responseHeaders, output):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -65,3 +65,4 @@ from Issue133 import *
|
||||
from Issue134 import *
|
||||
from Issue139 import *
|
||||
from Issue140 import *
|
||||
from Issue142 import *
|
||||
|
||||
@@ -157,6 +157,7 @@ class BasicTestCase(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
unittest.TestCase.tearDown(self)
|
||||
self.__closeReplayFileIfNeeded()
|
||||
github.Requester.Requester.resetConnectionClasses()
|
||||
|
||||
def __openFile(self, mode):
|
||||
for (_, _, functionName, _) in traceback.extract_stack():
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Vincent Jacques
|
||||
# vincent@vincent-jacques.net
|
||||
|
||||
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/
|
||||
|
||||
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import unittest
|
||||
import github
|
||||
|
||||
|
||||
class Issue142(unittest.TestCase): # https://github.com/jacquev6/PyGithub/issues/140
|
||||
def testDecodeJson(self):
|
||||
# This test has to hit GitHub for real, because the record-replay framework looses types
|
||||
# and python3 does not behave like python3 for strings and bytes
|
||||
self.assertEqual(github.Github().get_user("jacquev6").name, "Vincent Jacques")
|
||||
Reference in New Issue
Block a user