mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Fix #216: handle 'Link' header
Headers with capitals are returned by http.client (replacing httplib in Python 3)
This commit is contained in:
@@ -1947,7 +1947,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
if secret is not github.GithubObject.NotSet:
|
||||
post_parameters["hub.secret"] = secret
|
||||
|
||||
responseHeaders, output = self._requester.requestMultipartAndCheck(
|
||||
headers, output = self._requester.requestMultipartAndCheck(
|
||||
"POST",
|
||||
"/hub",
|
||||
input=post_parameters
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ class Requester:
|
||||
response = cnx.getresponse()
|
||||
|
||||
status = response.status
|
||||
responseHeaders = dict(response.getheaders())
|
||||
responseHeaders = dict((k.lower(), v) for k, v in response.getheaders())
|
||||
output = response.read()
|
||||
|
||||
cnx.close()
|
||||
|
||||
@@ -86,3 +86,4 @@ from Issue140 import *
|
||||
from Issue142 import *
|
||||
from Issue158 import *
|
||||
from Issue174 import *
|
||||
from Issue216 import *
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
############################ Copyrights and license ############################
|
||||
# #
|
||||
# Copyright 2013 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 Framework
|
||||
import github
|
||||
|
||||
|
||||
# Replay data forged by capitalizing headers from PaginatedList.setUp.txt and PaginatedList.testIteration.txt
|
||||
class Issue216(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.repo = self.g.get_user("openframeworks").get_repo("openFrameworks")
|
||||
self.list = self.repo.get_issues()
|
||||
|
||||
def testIteration(self):
|
||||
self.assertEqual(len(list(self.list)), 333)
|
||||
@@ -0,0 +1,22 @@
|
||||
https
|
||||
GET
|
||||
api.github.com
|
||||
None
|
||||
/users/openframeworks
|
||||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
|
||||
null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4929'), ('content-length', '564'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"cddd0710dc9490553aecd937e15d1136"'), ('date', 'Tue, 29 May 2012 19:36:56 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"type":"User","hireable":false,"url":"https://api.github.com/users/openframeworks","html_url":"https://github.com/openframeworks","public_gists":0,"blog":null,"bio":null,"public_repos":12,"company":null,"gravatar_id":"a858611b044a8302ab14cfe752e17369","login":"openframeworks","email":"","followers":399,"name":null,"avatar_url":"https://secure.gravatar.com/avatar/a858611b044a8302ab14cfe752e17369?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","created_at":"2009-10-21T21:54:37Z","location":null,"id":142866,"following":4}
|
||||
|
||||
https
|
||||
GET
|
||||
api.github.com
|
||||
None
|
||||
/repos/openframeworks/openFrameworks
|
||||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
|
||||
null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4928'), ('content-length', '1253'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e7459f63683768d5b53fc4b246d13a10"'), ('date', 'Tue, 29 May 2012 19:36:56 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"clone_url":"https://github.com/openframeworks/openFrameworks.git","has_downloads":true,"watchers":1745,"updated_at":"2012-05-29T19:23:07Z","permissions":{"pull":true,"admin":false,"push":false},"homepage":"http://openframeworks.cc","url":"https://api.github.com/repos/openframeworks/openFrameworks","html_url":"https://github.com/openframeworks/openFrameworks","has_wiki":true,"has_issues":true,"fork":false,"forks":349,"size":4232,"git_url":"git://github.com/openframeworks/openFrameworks.git","private":false,"open_issues":333,"svn_url":"https://github.com/openframeworks/openFrameworks","owner":{"url":"https://api.github.com/users/openframeworks","gravatar_id":"a858611b044a8302ab14cfe752e17369","login":"openframeworks","avatar_url":"https://secure.gravatar.com/avatar/a858611b044a8302ab14cfe752e17369?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":142866},"name":"openFrameworks","mirror_url":null,"language":"C","description":"OpenFrameworks is a cross platform open source toolkit for creative coding in C++.","ssh_url":"git@github.com:openframeworks/openFrameworks.git","pushed_at":"2012-05-29T19:23:07Z","created_at":"2009-10-21T21:55:54Z","id":345337,"full_name":"openframeworks/openFrameworks"}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user