1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-23 05:01:14 +01:00
gojekyll/Untitled.ipynb
2017-07-26 10:17:53 -04:00

124 lines
2.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import \"github.com/google/go-github/github\"\n",
"import \"context\"\n",
"import \"strings\"\n",
"import \"fmt\"\n",
"import \"net/http\"\n",
"import \"golang.org/x/oauth2\""
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "Error",
"evalue": "Unexpected stderr from execution",
"output_type": "error",
"traceback": [
"# command-line-arguments\n/var/folders/88/s1gtd_712x1776p302bl0_cr0000gp/T/203268841/gophernotes_session.go:24: cannot use http.Client literal (type *http.Client) as type *github.Client in assignment\n/var/folders/88/s1gtd_712x1776p302bl0_cr0000gp/T/203268841/gophernotes_session.go:25: cannot use client (type *github.Client) as type *http.Client in argument to github.NewClient\n/var/folders/88/s1gtd_712x1776p302bl0_cr0000gp/T/203268841/gophernotes_session.go:26: undefined: ctx in ctx.Background\n/var/folders/88/s1gtd_712x1776p302bl0_cr0000gp/T/203268841/gophernotes_session.go:27: undefined: ctx\n"
]
}
],
"source": [
"client := github.NewClient(nil)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"repo, _, err := client.Repositories.Get(ctx, \"osteele\", \"gojekyll\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"\"osteele.github.com\"\n"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fmt.Sprintf(\"%s.github.com\", strings.ToLower(*repo.Owner.Login))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"\"https://api.github.com/repos/osteele/gojekyll/contributors\"\n"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"repo.GetContributorsURL()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ctx := context.Background()\n",
"tc := oauth2.NewClient(ctx, nil)\n",
"client := github.NewClient(tc)"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Go",
"language": "go",
"name": "gophernotes"
},
"language_info": {
"name": "go"
}
},
"nbformat": 4,
"nbformat_minor": 0
}