GithubHelp home page GithubHelp logo

copitux / python-github3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kennethreitz/python-github3

206.0 206.0 72.0 666 KB

Python wrapper for GitHub API v3

Home Page: http://pygithub3.rtfd.org/

License: ISC License

Python 100.00%

python-github3's Introduction

copitux project

python-github3's People

Contributors

akaihola avatar conorbranagan avatar copitux avatar dsc avatar garbas avatar kijewski avatar pabelanger avatar ralphbean avatar stefanor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-github3's Issues

What to do about api changes?

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?

Test in `develop` branch failing

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)

pygithub3.services.repos.Forks 404 Errors

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

How to set proxies?

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?

repos.forks.create raises AssertionError

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

Converting `Repo` object?

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']

Use this library with enterprise github?

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.

Issues service

@copitux is there somebody working on that? I see that there is a topic branch in the repo (services/issues), but it doesn't seem to differ from master.

edit: @DataDog are you sending a pull request with your implementation?

Don't use SSLv3

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

Assigning labels to issues not possible

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.

Can't seem to get to parent/source for a repo fork

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.

Unable to install via pip (python 3.4)

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?

Installation err

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

ImportError: No module named 'github'

Please, add to requirements/base.txt module pygithub as depend.

Adding a collaborator to a repo returns pygithub3.exceptions.BadRequest: 400 - Problems parsing JSON

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.

Incompatible with Requests 0.14.0

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

BadRequest exception when adding a collaborator

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.

How to get the latest release of a repository?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.