no longer just digit has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to access the github API from Perl.
I tried two modules, Pithub and Net::GitHub::V3. In both cases I could access public data, but the only response I got was endless "Not Found" or "Authentication Required" when I tried to authenticate. In the case of Net::GitHub::V3, I tried both the token and the login/pass methods of logging in, but all I got was "Authentication Required".
The NGV script looks like this:
The documentation doesn't make it clear what else is required. For Pithub, I tried to use the token method, but that also failed.use Net::GitHub::V3; my $gh = Net::GitHub::V3->new ( login => '####', pass => '%%%%', ); my $repos = $gh->repos; my $rp = $gh->repos->create ({ name => 'hello-world', description => 'monkey business', homepage => 'www.exmpale.org', });
use FindBin '$Bin'; use Pithub; use Data::Dumper; use File::Slurper 'read_text'; my $token = read_text ("$Bin/token"); $token =~ s/\s//g; my $pid = Pithub->new ( user => '####', repo => '%%%%', token => $token, ); my $result = $pid->repos->get (); print Dumper $result;
Does anyone have a short working example of accessing github using either of these, or alternatively is there another module which has a documented example of how to log in?
Update I found App::ph on CPAN, but this is failing with the "Not Found" error when I type in my name and password.
This endless "Not Found" is rather frustrating.$ ph setup ph. please input your id/pw to this prompt. password will not sa +ve to any location. user: %%%% pass: #### Use of uninitialized value in pattern match (m//) at /home/ben/softwar +e/install/bin/ph line 362. HTTP/1.1 404 Not Found Connection: close Date: Mon, 22 Feb 2021 01:32:35 GMT Server: GitHub.com Vary: Accept-Encoding, Accept, X-Requested-With Content-Length: 74 Content-Type: application/json; charset=utf-8 Access-Control-Allow-Origin: * Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-Gi +tHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-I +nterval, X-GitHub-Media-Type, Deprecation, Sunset Client-Date: Mon, 22 Feb 2021 01:32:35 GMT Client-Peer: 52.69.239.207:443 Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=Di +giCert SHA2 High Assurance Server CA Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=GitHub, + Inc./CN=*.github.com Client-SSL-Cipher: TLS_AES_128_GCM_SHA256 Client-SSL-Socket-Class: IO::Socket::SSL Client-SSL-Version: TLSv1_3 Content-Security-Policy: default-src 'none' Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-or +igin Strict-Transport-Security: max-age=31536000; includeSubdomains; preloa +d X-Content-Type-Options: nosniff X-Frame-Options: deny X-GitHub-Media-Type: github.v3; format=json X-GitHub-Request-Id: EE38:0A8D:5C048:694DB:603309B3 X-RateLimit-Limit: 60 X-RateLimit-Remaining: 59 X-RateLimit-Reset: 1613961155 X-Ratelimit-Used: 1 X-XSS-Protection: 1; mode=block {"message":"Not Found","documentation_url":"https://docs.github.com/re +st"} $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to access github with Pithub/Net::GitHub::V3?
by tobyink (Canon) on Feb 22, 2021 at 10:16 UTC | |
by no longer just digit (Beadle) on Feb 22, 2021 at 12:40 UTC | |
by choroba (Cardinal) on Feb 22, 2021 at 23:12 UTC | |
by no longer just digit (Beadle) on Feb 25, 2021 at 05:07 UTC | |
by tobyink (Canon) on Feb 22, 2021 at 20:48 UTC | |
by no longer just digit (Beadle) on Feb 22, 2021 at 22:48 UTC | |
|
Re: How to access github with Pithub/Net::GitHub::V3?
by Discipulus (Canon) on Feb 22, 2021 at 07:21 UTC | |
by no longer just digit (Beadle) on Feb 22, 2021 at 10:02 UTC |