copitux / python-github3 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kennethreitz/python-github3
Python wrapper for GitHub API v3
Home Page: http://pygithub3.rtfd.org/
License: ISC License
This project forked from kennethreitz/python-github3
Python wrapper for GitHub API v3
Home Page: http://pygithub3.rtfd.org/
License: ISC License
copitux project
I used the api and I noticed some slight changes from the documentation. What should I do about it? Are you still working on it and would you like some help?
I've pulled the develop
branch and run the test with:
$ nosetests
Here's the error that I get:
ERROR: test_EDIT (pygithub3.tests.services.test_pull_requests.TestPullRequestCommentsService)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/dialelo/.virtualenvs/gh3/lib/python2.7/site-packages/mock.py", line 1224, in patched
return func(*args, **keywargs)
File "/home/dialelo/repos/python-github3/pygithub3/tests/services/test_pull_requests.py", line 178, in test_EDIT
self.service.edit(1, data)
AttributeError: 'Comments' object has no attribute 'edit'
----------------------------------------------------------------------
Ran 178 tests in 1.724s
FAILED (errors=1)
from .keys import keys
doesn't seem to work for pygithub3/service/user/init.py
this affects many other files also.
I'm sending an update with gh.issues.update(issueId, data)
.. data has a list of issue but none of them are being saved.
No matter how I configure the forks calls, I am getting a 404 error in response to both list
and create
calls.
g is my authenticated user object
>>> g.repos.forks.list(user='octocat', repo='oct_repo', sort='oldest').all()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/base.py", line 109, in all
return list(self.iterator())
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/base.py", line 104, in iterator
for page in self:
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/base.py", line 100, in next
return self.__next__()
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/smart.py", line 91, in __next__
if self.page <= self.pages:
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/smart.py", line 101, in pages
return self.getter.last
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/smart.py", line 47, in last
self()
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/smart.py", line 16, in wrapper
return func(self, page)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/result/smart.py", line 39, in __call__
response = self.method(page=page)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 84, in get
response = self.request('get', request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 71, in wrapper
return func(self, verb, request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 80, in request
GithubError(response).process()
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/errors.py", line 35, in process
raise raise_error()
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/errors.py", line 20, in error_404
raise NotFound("404 - %s" % self.debug.get('message'))
pygithub3.exceptions.NotFound: 404 - Not Found
I wrote my test code as follows:
from pygithub3 import Github
proxies = {"http": "http://<ip>:<port>", "https": "http://<ip>:<port>", }
gh = Github(login=<userID>, password=<userPWD>, token=<OAUTH-TOKEN>, proxies = proxies)
use = gh.users.get(<userID>)
Which raise:
File "/my/path/to/test/code/v1.py", line 10, in <module>
octocat = gh.users.get()
File "/usr/local/lib/python2.7/dist-packages/pygithub3/services/users/__init__.py", line 36, in get
return self._get(request)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/services/base.py", line 143, in _get
response = self._client.get(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 84, in get
response = self.request('get', request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 71, in wrapper
return func(self, verb, request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygithub3/core/client.py", line 77, in request
response = self.requester.request(verb, request, **kwargs)
File "/my/path/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/my/path/anaconda2/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/my/path/anaconda2/lib/python2.7/site-packages/requests/adapters.py", line 467, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user?access_token=<OAUTH-TOKEN>&per_page=100 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f4cbf2fb890>: Failed to establish a new connection: [Errno -5] No address associated with hostname',))
I tried link https//api.github.com/user?access_token=<OAUTH-TOKEN>&per_page=100 with requests
like:
import requests
proxies = { "http": "http://<IP>:<PORT>", "https": "http:<IP>:<PORT>", }
a = requests.get("https://api.github.com/user?access_token=<AOTH-TOKEN>&per_page=100", proxies=proxies)
for key, value in a.__dict__.items():
print key, ":", value
It works.
When I debug the first section of code described as above, I found an problem:
When run the gh = Github(login=<userID>, password=<userPWD>, token=<OAUTH-TOKEN>, proxies = proxies)
, gh._users._client.config
contains the params what I assigned. But when run the gh.users.get()
the gh.users._client.config={}
.
Could anyone tell me how to set proxies?
An AssertionError is raised on repos.forks.create
whether the request is successful or not. I would guess that the error on success is because the API is using another status code to denote that forks don't happen immediately but haven't looked at the actual return code to be sure.
Failure traceback:
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/services/repos/forks.py", line 52, in create
return self._post(request, **org)
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/services/base.py", line 151, in _post
response = self._client.post(request, data=input_data, **kwargs)
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/core/client.py", line 89, in post
assert response.status_code == 201
AssertionError
Success traceback:
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/services/repos/forks.py", line 52, in create
return self._post(request, **org)
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/services/base.py", line 151, in _post
response = self._client.post(request, data=input_data, **kwargs)
File "/home/aheadley/devel/project-envs/git-hub/lib/python2.7/site-packages/pygithub3/core/client.py", line 89, in post
assert response.status_code == 201
AssertionError
Greetings!
Is anyone doing any work to support the events api? If not, I'm interested in working on it.
I made a request for an organization's repositories, printed the result with the all()
function, and got this:
[<Repo (express-file)>, <Repo (users)>]
How would I convert this so the result is
['express-file', 'users']
Is there a way to use this library with enterprise github which has a different URL than github.com? I don't see an option in github class for this purpose. Thanks.
We have recently disabled support for SSLv3 at GitHub, as it is a very old version of the SSL protocol that is now also known to be vulnerable:
http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
https://www.imperialviolet.org/2014/10/14/poodle.html
We have had several reports from GitHub users using the Pygithub3 library, complaining of failing requests due to the use of SSLv3 in the library. Here's an example traceback that has been reported:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/pygithub3/services/users/__init__.py", line 36, in get
return self._get(request)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/pygithub3/services/base.py", line 142, in _get
response = self._client.get(request, **kwargs)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/pygithub3/core/client.py", line 83, in get
response = self.request('get', request, **kwargs)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/pygithub3/core/client.py", line 70, in wrapper
return func(self, verb, request, **kwargs)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/pygithub3/core/client.py", line 76, in request
response = self.requester.request(verb, request, **kwargs)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/requests/sessions.py", line 252, in request
r.send(prefetch=prefetch)
File "/Users/ray/virtualenv/pygh3/lib/python2.7/site-packages/requests/models.py", line 632, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol
/cc @copitux
The Repo API has been updated to include a merging API, which would be nice to have implemented in the library.
Hi the Search feature is not implemented yet, anyone is working on it ?
because I need this one ASAP : https://developer.github.com/v3/search/#search-users
It's not possible to assign labels to issues. Regardless of what is passed to add_to_issue
for the labels, there is always a ValueError thrown:
ValueError: Unable to encode lists with elements that are not 2-tuples.
Also, the example in the documentation is wrong, there are non-keyword arguments after keyword arguments.
Unless I'm missing something, I don't think pygithub3 lets us access the 'owner' and 'parent' attributes of a repo fork. It would be useful to be able to do so. E.g. one could use that information to create a clone with remotes for both a particular fork and its parent, and potentially the original source.
When trying to pip3 install pygithub3
I get the following
bot@theender:~/EnderBot3/bin$ ./pip3 install pygithub3
Downloading/unpacking pygithub3
Downloading pygithub3-0.5.1.tar.gz
Running setup.py (path:/home/znc/EnderBot3/build/pygithub3/setup.py) egg_info for package pygithub3
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/znc/EnderBot3/build/pygithub3/setup.py", line 7, in <module>
import pygithub3
File "/home/znc/EnderBot3/build/pygithub3/pygithub3/__init__.py", line 10, in <module>
from github import Github
ImportError: No module named 'github'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/znc/EnderBot3/build/pygithub3/setup.py", line 7, in <module>
import pygithub3
File "/home/znc/EnderBot3/build/pygithub3/pygithub3/__init__.py", line 10, in <module>
from github import Github
ImportError: No module named 'github'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/znc/EnderBot3/build/pygithub3
Storing debug log for failure in /home/znc/.pip/pip.log
Is there perhaps another step for installing that the readme doesn't tell about?
The Pull Requests api supports listing open and closed PRs via the 'state' opton (http://developer.github.com/v3/pulls/#list-pull-requests) but it is not available to pull_requests.list
(in version 0.4.1 from pip at least).
Collecting pygithub3
Using cached pygithub3-0.5.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 20, in
File "/tmp/pip-build-oqnq1i1i/pygithub3/setup.py", line 7, in
import pygithub3
File "/tmp/pip-build-oqnq1i1i/pygithub3/pygithub3/init.py", line 10, in
from github import Github
Please, add to requirements/base.txt
module pygithub
as depend.
I'm trying to add a collaborator to a repo with:
gh.repos.collaborators.add("collaborator-name", "name", "repo")
but I'm getting:
pygithub3.exceptions.BadRequest: 400 - Problems parsing JSON
Here is the full stack:
Traceback (most recent call last):
File "./test.py", line 8, in <module>
collaborators = gh.repos.collaborators.add("collaborator-name", "name", "repo")
File "/Library/Python/2.7/site-packages/pygithub3/services/repos/collaborators.py", line 40, in add
return self._put(request)
File "/Library/Python/2.7/site-packages/pygithub3/services/base.py", line 129, in _put
response = self._client.put(request, data=input_data, **kwargs)
File "/Library/Python/2.7/site-packages/pygithub3/core/client.py", line 100, in put
response = self.request('put', request, **kwargs)
File "/Library/Python/2.7/site-packages/pygithub3/core/client.py", line 71, in wrapper
return func(self, verb, request, **kwargs)
File "/Library/Python/2.7/site-packages/pygithub3/core/client.py", line 81, in request
GithubError(response).process()
File "/Library/Python/2.7/site-packages/pygithub3/core/errors.py", line 35, in process
raise raise_error()
File "/Library/Python/2.7/site-packages/pygithub3/core/errors.py", line 23, in error_400
raise BadRequest("400 - %s" % self.debug.get('message'))
pygithub3.exceptions.BadRequest: 400 - Problems parsing JSON
I tried deleting and listing, they both work fine, but adding doesn't work. Could you please advice? Thanks.
It looks like something in Requests 0.14.0 (maybe ealier, I've been using 0.13.2) has broken the way python-github3 handles session params.
Creating a Github
object fails with the following traceback:
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'0.14.0'
>>> from pygithub3 import Github
>>> gh = Github()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pygithub3/github.py", line 24, in __init__
self._users = User(**config)
File "pygithub3/services/users/__init__.py", line 14, in __init__
self.keys = Keys(**config)
File "pygithub3/services/base.py", line 44, in __init__
self._client = Client(**config)
File "pygithub3/core/client.py", line 29, in __init__
self.__set_params(self.config)
File "pygithub3/core/client.py", line 56, in __set_params
self.requester.params['per_page'] = config.get('per_page')
TypeError: list indices must be integers, not str
The following:
from pygithub3 import Github
Github(token='token').repos.collaborators.add('collaborator', user='user', repo='repo')
fails with pygithub3.exceptions.BadRequest: 400 - Problems parsing JSON
after GitHub tries to interpret the PLACEHOLDER
(submitted by pygithub.services.base.Service._put
) as JSON.
I try to get the latest release of a repository but i cant figure out how to correctly do this with python-github3?
i know hot to get all the releases and i think that the first of them may be always the latest but is this true and how can i be sure?
latest_release = None
releases = online_repo.releases()
for release in releases:
latest_release = release
break
Just like in:
GET /repos/:owner/:repo/releases/latest
https://developer.github.com/v3/repos/releases/#get-the-latest-release
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.