Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Failure ?? #80

Closed
mnsanghvi opened this issue Sep 12, 2012 · 15 comments
Closed

Assertion Failure ?? #80

mnsanghvi opened this issue Sep 12, 2012 · 15 comments
Assignees
Milestone

Comments

@mnsanghvi
Copy link

>>> 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
Copy link

ive gotten this trying the same operation against an enterprise version of github as well.

+1

@jacquev6
Copy link
Member

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

@ghost ghost assigned jacquev6 Sep 12, 2012
@jacquev6
Copy link
Member

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
Copy link
Author

I did the following:

 print gh.get_organization( org_name ).url

and I got:

 https://github.internal.tld/api/v3/orgs/org_name

The base_url I had used was

 http://github.internal.tld/api/v3

So it has been changed to use https which we do not use internally.

@jacquev6
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link
Member

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

@mnsanghvi
Copy link
Author

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

@jacquev6
Copy link
Member

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

@mnsanghvi
Copy link
Author

duh ! that was quick :)

thanks.

@mnsanghvi
Copy link
Author

>>> 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
Copy link
Member

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants