Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Assertion Failure ?? #80

Closed
mnsanghvi opened this Issue · 15 comments

3 participants

@mnsanghvi
>>> from github import Github
>>> gh = Github( "login", "password", "base_url")
>>> for repo in gh.get_user().get_repos():
...         print repo.name
...
repo1
repo2
my-person-linux-kernel-repo
the-secret-macosx-repo

>>> for repo in gh.get_organization( org_name ).get_repos():
...         print repo.name
...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.7-intel/egg/github/Organization.py", line 311, in get_repos
  File "build/bdist.macosx-10.7-intel/egg/github/Requester.py", line 60, in requestAndCheck
  File "build/bdist.macosx-10.7-intel/egg/github/Requester.py", line 76, in requestRaw
AssertionError

Is this because of my lack of knowledge about python, or is there something else going on here ?

What I would like to do is be able to get a list of the hooks in all the repos in an organization and also go through that list of repos in an organization and be able to create hooks.

@gregwjacobs
@jacquev6
Owner

Definitely not a lack of knowledge on your part. I'll investigate (and hopefully fix it) today.

@jacquev6 jacquev6 was assigned
@jacquev6
Owner

Ok, this has to be related to the Enterprise thing, and I don't have access to a Github Enterprise server.

Can you please check that gh.get_organization( org_name ).url starts with the base_url you give to the Github constructor?

@mnsanghvi
@jacquev6
Owner

This behavior of Github Enterprise looks like a bug to me.

Anyway, I will work around it in PyGithub. I will publish the fix in version 1.7 tonight.

Note to myself:

  • In Requester.requestRaw, urlparse.urlparse the requested url instead of checking if it startswith self.__baseUrl or "/"
  • then assert that
    • the path startswith self.__prefix
    • the port is the same
    • the scheme is either the same or "https" if the self.__baseUrl scheme was "http"
  • forge a test case with a returned url starting with https instead of http
@mnsanghvi

For your assert, shouldn't that be:

   the scheme is either the same or "https" if the self.__baseUrl scheme was NOT "http" ? 

The way you've stated it, it sounds like that you're going to replace http with https.

@jacquev6
Owner

Don't worry, my plan is to keep all informations from base_url and use only the parts I need from the requested url, so if you say that you use http in base_url, I will keep this scheme for all requests.

@mnsanghvi

Well now I'm not worried :)

I'm planning to fork the project and work on the documentation of it. I think there might be a better way to generate the class reference and also provide some code samples, a sort of tutorial.

@jacquev6
Owner

That would be great! I open issue #82 to discuss this subject. When you want to take time to think about that, feel free to discuss in this issue.

@jacquev6
Owner

This should be fixed by previous commit, so I close the issue to be able to close the milestone tonight. Do not hesitate to re-open it if you still have related problems with version 1.7

@jacquev6 jacquev6 closed this
@mnsanghvi

How quickly will this show up in whatever repository is used by easy_install ? I'm on a MacOS X system.

@jacquev6
Owner

It's already on PyPi, so easy_install --upgrade PyGithub should fetch it.

@mnsanghvi

duh ! that was quick :)

thanks.

@mnsanghvi
>>> gh = Github( login, password, github_url)
>>> for org in gh.get_organization( org_name ).get_repos():
...     print org.name
... 

a-very-nice-repo
my-linux-kernel-repo
my-pygithub
repo1
repo2
sandbox1
sandbox3

>>>

It works !!! :)

@jacquev6
Owner

\o/

@mnsanghvi mnsanghvi added the v1 label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.