cscheid / rgithub

R bindings for the github API
MIT License
70 stars 31 forks source link

Creating a repository #61

Closed csgillespie closed 6 years ago

csgillespie commented 8 years ago

This works

me = get.myself(ctx)
me$content$login
[1] "csgillespie"

When I try to create a repo I get:

R> create.repository(name="my_new_repo1",ctx = ctx)
-> POST /user/repos?XXXXX
-> User-Agent: R (3.2.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
-> Host: api.github.com
-> Accept-Encoding: gzip, deflate
-> Accept: application/vnd.github.beta+json
-> Content-Length: 23
-> 
>> {"name":"my_new_repo1"}

<- HTTP/1.1 404 Not Found
<- Server: GitHub.com
<- Date: Thu, 25 Feb 2016 10:04:50 GMT
<- Content-Type: application/json; charset=utf-8
<- Transfer-Encoding: chunked
<- Status: 404 Not Found
<- X-RateLimit-Limit: 5000
<- X-RateLimit-Remaining: 4997
<- X-RateLimit-Reset: 1456398194
<- X-OAuth-Scopes: 
<- X-Accepted-OAuth-Scopes: public_repo, repo
<- X-OAuth-Client-Id: 62db374708d74cfdafa5
<- X-GitHub-Media-Type: github.beta; format=json
<- Access-Control-Allow-Credentials: true
<- Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
<- Access-Control-Allow-Origin: *
<- Content-Security-Policy: default-src 'none'
<- Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
<- X-Content-Type-Options: nosniff
<- X-Frame-Options: deny
<- X-XSS-Protection: 1; mode=block
<- Content-Encoding: gzip
<- X-GitHub-Request-Id: 80F0E120:C8D0:ECB53EA:56CED1C2
<- 
$ok
[1] FALSE

$content
$content$message
[1] "Not Found"

$content$documentation_url
[1] "https://developer.github.com/v3"

$headers
$server
[1] "GitHub.com"

$date
[1] "Thu, 25 Feb 2016 10:04:50 GMT"

$`content-type`
[1] "application/json; charset=utf-8"

$`transfer-encoding`
[1] "chunked"

$status
[1] "404 Not Found"

$`x-ratelimit-limit`
[1] "5000"

$`x-ratelimit-remaining`
[1] "4997"

$`x-ratelimit-reset`
[1] "1456398194"

$`x-oauth-scopes`
[1] ""

$`x-accepted-oauth-scopes`
[1] "public_repo, repo"

$`x-oauth-client-id`
[1] "62db374708d74cfdafa5"

$`x-github-media-type`
[1] "github.beta; format=json"

$`access-control-allow-credentials`
[1] "true"

$`access-control-expose-headers`
[1] "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval"

$`access-control-allow-origin`
[1] "*"

$`content-security-policy`
[1] "default-src 'none'"

$`strict-transport-security`
[1] "max-age=31536000; includeSubdomains; preload"

$`x-content-type-options`
[1] "nosniff"

$`x-frame-options`
[1] "deny"

$`x-xss-protection`
[1] "1; mode=block"

$`content-encoding`
[1] "gzip"

$`x-github-request-id`
[1] "80F0E120:C8D0:ECB53EA:56CED1C2"

attr(,"class")
[1] "insensitive" "list"       

$code
[1] 404

R> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] github_0.9.7   httr_1.1.0     colorout_1.1-1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3     mime_0.4        R6_2.1.2        jsonlite_0.9.19 magrittr_1.5    stringi_1.0-1   curl_0.9.5     
 [8] xml2_0.1.2      fortunes_1.5-2  brew_1.0-6      tools_3.2.3     stringr_1.0.0   Rook_1.1-1      httpuv_1.3.3   
[15] openssl_0.9.1  
cscheid commented 8 years ago

Are you sure you're authenticating correctly (I'm guessing, eg, oauth scopes might be the problem)?

I just tried this:

> create.github.context(personal_token = "my-personal-token-here")
> create.repository(name="my_test_repo")

And you can see that it did the right thing.

csgillespie commented 8 years ago

I didn't run create.github.context.

Thanks

cscheid commented 8 years ago

This snippet:

Adding .httr-oauth to .gitignore

makes me think it's some weird HTTR interaction. I know httr changed recently, and so I want to keep an eye on it. For the time being, creating a personal access token is the easiest thing to do.

cscheid commented 6 years ago

Closed (wontfix) by #70.