GithubHelp home page GithubHelp logo

Comments (2)

jacquev6 avatar jacquev6 commented on May 21, 2024

UnknownGithubObject is the exception I throw when you request an object that doesn't exist. Here, there is no download with id 1 or "foobar" in your repo.

The TypeError you get when calling repo.get_download()is because get_download requires an argument as stated in the reference of classes (See "Downloads" in "class Repository").

So, what argument should you pass to get_downloads? Well, the documentation says id, so you can first call get_downloads which returns a list of Downloads, and look what is Download.id.

The fact is that I have no repository to test this with downloads, but here is an example with issues (g is a Github instance):

>>> g.get_user().get_repo( "PyGithub" ).get_issues()[0].number
23
>>> g.get_user().get_repo( "PyGithub" ).get_issue( 23 )
<github.GithubObjects.GithubObject.GithubObject.Issue instance at 0x10c9aaea8>

(I took the number attribute of the first Issue, because the reference says that get_issue takes a number.)

I hope it helps.

from pygithub.

tallforasmurf avatar tallforasmurf commented on May 21, 2024

I hope this report will be useful, however, I am not going to be using this package after all. I discovered (what should have been obvious) that I can get everything I need from github just using urllib and reading the page.

import urllib2
try:
    u = urllib2.urlopen( 'https://github.com/<user>/<public-repo>', timeout=5 )
except:
    #cannot contact github - try later
    #exit
s = u.read()
u.close()

It's all there, file names, SHA, last commit date, and if I want to read file data, no need to decode a blob, it's at https://raw.github.com/<user>/<public-repo>/master/<filename>

from pygithub.

Related Issues (20)

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.