[Israel.pm] Reading files off Github

Meir Kriheli mkriheli at gmail.com
Thu Feb 21 07:55:07 PST 2013


Hi,

You can use their API:
http://developer.github.com/v3/repos/contents/#get-contents

For the example given in this thread:

$ curl https://api.github.com/repos/gaal/app-csv/contents/bin
[
  {
    "sha": "55669c67601dc74bf4d751d16f79cd3029fe8508",
    "size": 5131,
    "name": "csv",
    "path": "bin/csv",
    "type": "file",
    "url": "https://api.github.com/repos/gaal/app-csv/contents/bin/csv",
    "git_url": "
https://api.github.com/repos/gaal/app-csv/git/blobs/55669c67601dc74bf4d751d16f79cd3029fe8508
",
    "html_url": "https://github.com/gaal/app-csv/blob/master/bin/csv",
    "_links": {
      "self": "https://api.github.com/repos/gaal/app-csv/contents/bin/csv",
      "git": "
https://api.github.com/repos/gaal/app-csv/git/blobs/55669c67601dc74bf4d751d16f79cd3029fe8508
",
      "html": "https://github.com/gaal/app-csv/blob/master/bin/csv"
    }
  }
]


Cheers


On Thu, Feb 21, 2013 at 5:46 PM, Shmuel Fomberg <shmuelfomberg at gmail.com>wrote:

> Hi Gaal.
>
> This give me access to files that I already know exists.
> What about reading directories?
> If I remove the 'csv' from the URL, I get 404...
>
> Shmuel.
>
>
> On Thu, Feb 21, 2013 at 8:06 PM, Gaal Yahas <gaal at forum2.org> wrote:
>
>> Pretty trivial filename substitution to make a URL for the raw version,
>> no?
>>
>> E.g., github.com/gaal/app-csv/bin/csv =>
>> https://raw.github.com/gaal/app-csv/master/bin/csv
>>
>> Just use HTTP.
>>
>> On Thu, Feb 21, 2013 at 7:24 AM, Shmuel Fomberg <shmuelfomberg at gmail.com>wrote:
>>
>>> Hi all.
>>>
>>> Is there a module that let me read files from github respo?
>>> I see a bunch of API wrappers, such as Net::Github and Pithub, but not
>>> high-level module.
>>>
>>> Shmuel.
>>>
>>> _______________________________________________
>>> Perl mailing list
>>> Perl at perl.org.il
>>> http://mail.perl.org.il/mailman/listinfo/perl
>>>
>>
>>
>>
>> --
>> Gaal Yahas <gaal at forum2.org>
>> http://gaal.livejournal.com/
>>
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://mail.perl.org.il/mailman/listinfo/perl
>>
>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
Meir Kriheli
http://meirkriheli.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20130221/b9831639/attachment.htm 


More information about the Perl mailing list