https
GET
api.github.com
None
/gists/6296732
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('content-length', '26707'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '3061975e1f37121b3751604ad153c687'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"1c7d4253540b5f2dce518343258085ff"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('x-github-media-type', 'github.v3; format=json'), ('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'), ('x-github-request-id', '62E80DDA:1FFE:2F9F3B3:5366987A'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Sun, 04 May 2014 19:18:39 GMT'), ('date', 'Sun, 04 May 2014 19:43:54 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1399236081')]
{"url":"https://api.github.com/gists/6296732","forks_url":"https://api.github.com/gists/6296732/forks","commits_url":"https://api.github.com/gists/6296732/commits","id":"6296732","git_pull_url":"https://gist.github.com/6296732.git","git_push_url":"https://gist.github.com/6296732.git","html_url":"https://gist.github.com/6296732","files":{"GithubAPI.lua":{"filename":"GithubAPI.lua","type":"text/plain","language":"Lua","raw_url":"https://gist.githubusercontent.com/jacquev6/6296732/raw/88aafa25fb28e17013054a117354a37f0d78963c/GithubAPI.lua","size":21229,"content":"-- GithubAPI\n-- @Author : Hyro Vitaly Protago\n-- @Version : 1.0.0\n\n--[[\n\nINFOS :\n  - Cannot delete an anonymous gist\n]]--\n\nGithubAPI = {\n\tlocation = \"https://api.github.com/\",\n\ttoken = nil,\n\tOAuth = {\n\t\tauthorizations = {}\n\t},\n\tgist = {\n\t\tlist = {},\n\t\tcomment = {}\n\t},\n\tgithub = {}\n}\n\n----------------------------------------------------------------------------\n------------------------------ Github API ----------------------------------\n----------------------------------------------------------------------------\n\n--- Authentication ---\n\n--[[ Scopes --\n\nScopes let you specify exactly what type of access you need. Scopes limit access for OAuth tokens.\nThey do not grant any additional permission beyond that which the user already has.\n\nFor the web flow, requested scopes will be displayed to the user on the authorize form.\n\nCheck headers to see what OAuth scopes you have, and what the API action accepts.\n\n~~~\n$ curl -H \"Authorization: token OAUTH-TOKEN\" https://api.github.com/users/technoweenie -I\nHTTP/1.1 200 OK\nX-OAuth-Scopes: repo, user\nX-Accepted-OAuth-Scopes: user\nX-OAuth-Scopes lists the scopes your token has authorized. X-Accepted-OAuth-Scopes lists the scopes that the action checks for.\n~~~\n\n- (no scope)\npublic read-only access (includes public user profile info, public repo info, and gists).\n- user\nRead/write access to profile info only. Note: this scope includes user:email and user:follow.\n- user:email\nRead access to a user’s email addresses.\n- user:follow\nAccess to follow or unfollow other users.\n- public_repo\nRead/write access to public repos and organizations.\n- repo\nRead/write access to public and private repos and organizations.\n- repo:status\nRead/write access to public and private repository commit statuses.\nThis scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.\nThe repo and public_repo scopes already include access to commit status for private and public repositories respectively.\n- delete_repo\nDelete access to adminable repositories.\n- notifications\nRead access to a user’s notifications. repo is accepted too.\n- gist\nWrite access to gists.\n\nNOTE: Your application can request the scopes in the initial redirection. You can specify multiple scopes by separating them by a comma.\n~~~\nhttps://github.com/login/oauth/authorize?\n  client_id=...&\n  scope=user,public_repo\n~~~\n]]--\n\n-- Redirect users to request GitHub access --\nfunction GithubAPI.OAuth.getToken(client_id, scope, callback)\n\tGithubAPI.http_request(\"https://github.com/login/oauth/authorize?client_id=\"..client_id..\"&scope=\"..scope, function(data, status, headers)\n\t\tGithubAPI.OAuth._getToken(client_id, client_secret, data, callback)\n\tend, nil, true)\nend\n-- GitHub redirects back to your site --\nfunction GithubAPI.OAuth._getToken(client_id, client_secret, code, callback)\n\tGithubAPI.http_request(\"https://github.com/login/oauth/access_token\", callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tclient_id = client_id,\n\t\t\tclient_secret = client_secret,\n\t\t\tcode = code\n\t\t}\n\t}, true)\nend\n\n-- List your authorizations --\nfunction GithubAPI.OAuth.authorizations.list(callback)\n\tGithubAPI.http_request(\"authorizations\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nLink: <https://api.github.com/resource?page=2>; rel=\"next\",\n      <https://api.github.com/resource?page=5>; rel=\"last\"\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"id\": 1,\n    \"url\": \"https://api.github.com/authorizations/1\",\n    \"scopes\": [\n      \"public_repo\"\n    ],\n    \"token\": \"abc123\",\n    \"app\": {\n      \"url\": \"http://my-github-app.com\",\n      \"name\": \"my github app\",\n      \"client_id\": \"abcde12345fghij67890\"\n    },\n    \"note\": \"optional note\",\n    \"note_url\": \"http://optional/note/url\",\n    \"updated_at\": \"2011-09-06T20:39:23Z\",\n    \"created_at\": \"2011-09-06T17:26:27Z\"\n  }\n]\n]]--\n\n-- Get a single authorization --\nfunction GithubAPI.OAuth.authorizations.get(id, callback)\n\tGithubAPI.http_request(\"authorizations/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/authorizations/1\",\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"token\": \"abc123\",\n  \"app\": {\n    \"url\": \"http://my-github-app.com\",\n    \"name\": \"my github app\",\n    \"client_id\": \"abcde12345fghij67890\"\n  },\n  \"note\": \"optional note\",\n  \"note_url\": \"http://optional/note/url\",\n  \"updated_at\": \"2011-09-06T20:39:23Z\",\n  \"created_at\": \"2011-09-06T17:26:27Z\"\n}\n]]--\n\n-- Create a new authorization --\nfunction GithubAPI.OAuth.authorizations.create(callback, scopes, note, note_url, client_id, client_secret)\n\tGithubAPI.http_request(\"authorizations/\", callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tscopes = scopes,\n\t\t\tnote = note,\n\t\t\tnote_url = note_url,\n\t\t\tclient_id = client_id,\n\t\t\tclient_secret = client_secret\n\t\t}\n\t})\nend\n\n--[[ Input --\nscopes\nOptional array - A list of scopes that this authorization is in.\n\nnote\nOptional string - A note to remind you what the OAuth token is for.\n\nnote_url\nOptional string - A URL to remind you what app the OAuth token is for.\n\nclient_id\nOptional String - The 20 character OAuth app client key for which to create the token.\n\nclient_secret\nOptional String - The 40 character OAuth app client secret for which to create the token.\n~~~\n{\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"note\": \"admin script\"\n}\n~~~\n]]--\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/authorizations/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/authorizations/1\",\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"token\": \"abc123\",\n  \"app\": {\n    \"url\": \"http://my-github-app.com\",\n    \"name\": \"my github app\",\n    \"client_id\": \"abcde12345fghij67890\"\n  },\n  \"note\": \"optional note\",\n  \"note_url\": \"http://optional/note/url\",\n  \"updated_at\": \"2011-09-06T20:39:23Z\",\n  \"created_at\": \"2011-09-06T17:26:27Z\"\n}\n]]--\n\n-- TODO\n-- Update\n-- Check\n-- Delete\n\n--- GISTS ---\n\n-- List gists --\nfunction GithubAPI.gist.list.user(user, callback)\n\tGithubAPI.http_request(\"users/\"..user..\"/gists\", callback)\nend\nfunction GithubAPI.gist.list.all(callback) -- return all public gists if called anonymously\n\tGithubAPI.http_request(\"gists\", callback)\nend\nfunction GithubAPI.gist.list.allPublic(callback)\n\tGithubAPI.http_request(\"gists/public\", callback)\nend\nfunction GithubAPI.gist.list.starred(callback)\n\tGithubAPI.http_request(\"gists/starred\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nLink: <https://api.github.com/resource?page=2>; rel=\"next\",\n      <https://api.github.com/resource?page=5>; rel=\"last\"\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n    \"id\": \"1\",\n    \"description\": \"description of gist\",\n    \"public\": true,\n    \"user\": {\n      \"login\": \"octocat\",\n      \"id\": 1,\n      \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n      \"gravatar_id\": \"somehexcode\",\n      \"url\": \"https://api.github.com/users/octocat\"\n    },\n    \"files\": {\n      \"ring.erl\": {\n        \"size\": 932,\n        \"filename\": \"ring.erl\",\n        \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n      }\n    },\n    \"comments\": 0,\n    \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n    \"html_url\": \"https://gist.github.com/1\",\n    \"git_pull_url\": \"git://gist.github.com/1.git\",\n    \"git_push_url\": \"git@gist.github.com:1.git\",\n    \"created_at\": \"2010-04-14T02:15:15Z\"\n  }\n]\n]]--\n\n-- Get a single gist --\nfunction GithubAPI.gist.get(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Create a gist --\nfunction GithubAPI.gist.create(public, files, callback ,description)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tpublic = public,\n\t\t\tfiles = files,\n\t\t\tdescription = description\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"description\": \"the description for this gist\",\n  \"public\": true,\n  \"files\": {\n    \"file1.txt\": {\n      \"content\": \"String file contents\"\n    }\n  }\n}\n]]--\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Edit a gist --\nfunction GithubAPI.gist.edit(id, files, callback, description)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {\n\t\tmethod = \"PATCH\",\n\t\tdata = {\n\t\t\tid = id,\n\t\t\tfiles = files,\n\t\t\tdescription = description\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"description\": \"the description for this gist\",\n  \"files\": {\n    \"file1.txt\": {\n      \"content\": \"updated file contents\"\n    },\n    \"old_name.txt\": {\n      \"filename\": \"new_name.txt\",\n      \"content\": \"modified contents\"\n    },\n    \"new_file.txt\": {\n      \"content\": \"a new file\"\n    },\n    \"delete_this_file.txt\": null\n  }\n}\n]]--\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Star a gist --\nfunction GithubAPI.gist.star(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback, {method=\"PUT\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Unstar a gist --\nfunction GithubAPI.gist.unstar(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback, {method=\"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Check if a gist is starred --\nfunction GithubAPI.gist.checkStar(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback)\nend\n\n--[[\n-- Response if gist is starred --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n\n-- Response if gist is not starred --\nStatus: 404 Not Found\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Fork a gist --\nfunction GithubAPI.gist.fork(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/forks\", callback, {method=\"POST\"})\nend\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/2\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\"\n}\n]]--\n\n-- Delete a gist --\nfunction GithubAPI.gist.delete(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {method=\"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n--- GISTS COMMENTS ---\n\n-- List comments on a gist --\nfunction GithubAPI.gist.comment.list(gist_id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"id\": 1,\n    \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n    \"body\": \"Just commenting for the sake of commenting\",\n    \"user\": {\n      \"login\": \"octocat\",\n      \"id\": 1,\n      \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n      \"gravatar_id\": \"somehexcode\",\n      \"url\": \"https://api.github.com/users/octocat\"\n    },\n    \"created_at\": \"2011-04-18T23:23:56Z\"\n  }\n]\n]]--\n\n-- Get a single comment --\nfunction GithubAPI.gist.comment.get(gist_id, id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Create a comment --\nfunction GithubAPI.gist.comment.create(gist_id, body, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tbody = body\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"body\": \"Just commenting for the sake of commenting\"\n}\n]]--\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/comments/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Edit a comment --\nfunction GithubAPI.gist.comment.edit(gist_id, id, body, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {\n\t\tmethod = \"PATCH\",\n\t\tdata = {\n\t\t\tbody = body\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"body\": \"Just commenting for the sake of commenting\"\n}\n]]--\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Delete a comment --\nfunction GithubAPI.gist.comment.delete(gist_id, id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {method = \"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n----------------------------------------------------------------------------\n-------------------------------- TOOLS -------------------------------------\n----------------------------------------------------------------------------\n\nfunction GithubAPI.http_request(url, callback, opts, fullUrl)\n\topts = opts or {}\n\t-- if GithubAPI.token then opts.headers = TOKEN BEARER\n\tif opts.data then opts.data = json.encode(opts.data) end\n\n\tlocal _url\n\tif (fullUrl) then _url = url else _url = GithubAPI.location .. url end\n\n\thttp.request(_url, function(data, status, headers)\n\t\tif (status == 500) then error(\"Github: Internal Server Error ...\") end\n\t\tdata = json.decode(data)\n\t\tcallback(data, status, headers)\n\tend, alert, opts)\nend\n\nfunction GithubAPI.explode(div,str) -- credit: http://richard.warburton.it\n  if (div=='') then return false end\n  local pos,arr = 0,{}\n  for st,sp in function() return string.find(str,div,pos,true) end do\n    table.insert(arr,string.sub(str,pos,st-1))\n    pos = sp + 1\n  end\n  table.insert(arr,string.sub(str,pos))\n  return arr\nend\n\n-- GITHUB TIMESTAMP (YYYY-MM-DDTHH:MM:SSZ) to os.time\nfunction GithubAPI.gtimestamp(githubTime)\n\tgithubTime = githubTime:sub(1, #githubTime-1) -- remove Z\n\tgithubTime = GithubAPI.explode(\"T\", githubTime)\n\tgithubTime[1] = GithubAPI.explode(\"-\", githubTime[1])\n\tgithubTime[2] = GithubAPI.explode(\":\", githubTime[2])\n\treturn os.time({\n\t\tyear = tonumber(githubTime[1][1]),\n\t\tmonth = tonumber(githubTime[1][2]),\n\t\tday = tonumber(githubTime[1][3]),\n\t\thour = tonumber(githubTime[2][1]),\n\t\tmin = tonumber(githubTime[2][2]),\n\t\tsec = tonumber(githubTime[2][3])\n\t})\nend"}},"public":true,"created_at":"2013-08-21T16:28:24Z","updated_at":"2013-08-21T16:28:24Z","description":"Github API","comments":0,"user":null,"comments_url":"https://api.github.com/gists/6296732/comments","owner":{"login":"jacquev6","id":327146,"avatar_url":"https://avatars.githubusercontent.com/u/327146?","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"fork_of":{"url":"https://api.github.com/gists/6296553","forks_url":"https://api.github.com/gists/6296553/forks","commits_url":"https://api.github.com/gists/6296553/commits","id":"6296553","git_pull_url":"https://gist.github.com/6296553.git","git_push_url":"https://gist.github.com/6296553.git","html_url":"https://gist.github.com/6296553","files":{},"public":true,"created_at":"2013-08-21T16:12:27Z","updated_at":"2013-10-23T14:58:31Z","description":"Github API","comments":0,"user":null,"comments_url":"https://api.github.com/gists/6296553/comments","owner":{"login":"HyroVitalyProtago","id":3470988,"avatar_url":"https://avatars.githubusercontent.com/u/3470988?","gravatar_id":"ed59562b231a649345f38703948f76f4","url":"https://api.github.com/users/HyroVitalyProtago","html_url":"https://github.com/HyroVitalyProtago","followers_url":"https://api.github.com/users/HyroVitalyProtago/followers","following_url":"https://api.github.com/users/HyroVitalyProtago/following{/other_user}","gists_url":"https://api.github.com/users/HyroVitalyProtago/gists{/gist_id}","starred_url":"https://api.github.com/users/HyroVitalyProtago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyroVitalyProtago/subscriptions","organizations_url":"https://api.github.com/users/HyroVitalyProtago/orgs","repos_url":"https://api.github.com/users/HyroVitalyProtago/repos","events_url":"https://api.github.com/users/HyroVitalyProtago/events{/privacy}","received_events_url":"https://api.github.com/users/HyroVitalyProtago/received_events","type":"User","site_admin":false}},"forks":[],"history":[{"user":null,"version":"c464aecd7fea16684e935607eeea7ae4f8caa0e2","committed_at":"2013-08-21T16:12:27Z","change_status":{"total":793,"additions":793,"deletions":0},"url":"https://api.github.com/gists/6296732/c464aecd7fea16684e935607eeea7ae4f8caa0e2"}]}

https
GET
api.github.com
None
/gists/6296732/c464aecd7fea16684e935607eeea7ae4f8caa0e2
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('content-length', '26707'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '03d91026ad8428f4d9966d7434f9d82e'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"893689529e8ac78913dad210662443ac"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4983'), ('x-github-media-type', 'github.v3; format=json'), ('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'), ('x-github-request-id', '62E80DDA:1FFB:7D4619:5366987A'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Sun, 04 May 2014 19:43:54 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1399236081')]
{"url":"https://api.github.com/gists/6296732","forks_url":"https://api.github.com/gists/6296732/forks","commits_url":"https://api.github.com/gists/6296732/commits","id":"6296732","git_pull_url":"https://gist.github.com/6296732.git","git_push_url":"https://gist.github.com/6296732.git","html_url":"https://gist.github.com/6296732","files":{"GithubAPI.lua":{"filename":"GithubAPI.lua","type":"text/plain","language":"Lua","raw_url":"https://gist.githubusercontent.com/jacquev6/6296732/raw/88aafa25fb28e17013054a117354a37f0d78963c/GithubAPI.lua","size":21229,"content":"-- GithubAPI\n-- @Author : Hyro Vitaly Protago\n-- @Version : 1.0.0\n\n--[[\n\nINFOS :\n  - Cannot delete an anonymous gist\n]]--\n\nGithubAPI = {\n\tlocation = \"https://api.github.com/\",\n\ttoken = nil,\n\tOAuth = {\n\t\tauthorizations = {}\n\t},\n\tgist = {\n\t\tlist = {},\n\t\tcomment = {}\n\t},\n\tgithub = {}\n}\n\n----------------------------------------------------------------------------\n------------------------------ Github API ----------------------------------\n----------------------------------------------------------------------------\n\n--- Authentication ---\n\n--[[ Scopes --\n\nScopes let you specify exactly what type of access you need. Scopes limit access for OAuth tokens.\nThey do not grant any additional permission beyond that which the user already has.\n\nFor the web flow, requested scopes will be displayed to the user on the authorize form.\n\nCheck headers to see what OAuth scopes you have, and what the API action accepts.\n\n~~~\n$ curl -H \"Authorization: token OAUTH-TOKEN\" https://api.github.com/users/technoweenie -I\nHTTP/1.1 200 OK\nX-OAuth-Scopes: repo, user\nX-Accepted-OAuth-Scopes: user\nX-OAuth-Scopes lists the scopes your token has authorized. X-Accepted-OAuth-Scopes lists the scopes that the action checks for.\n~~~\n\n- (no scope)\npublic read-only access (includes public user profile info, public repo info, and gists).\n- user\nRead/write access to profile info only. Note: this scope includes user:email and user:follow.\n- user:email\nRead access to a user’s email addresses.\n- user:follow\nAccess to follow or unfollow other users.\n- public_repo\nRead/write access to public repos and organizations.\n- repo\nRead/write access to public and private repos and organizations.\n- repo:status\nRead/write access to public and private repository commit statuses.\nThis scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.\nThe repo and public_repo scopes already include access to commit status for private and public repositories respectively.\n- delete_repo\nDelete access to adminable repositories.\n- notifications\nRead access to a user’s notifications. repo is accepted too.\n- gist\nWrite access to gists.\n\nNOTE: Your application can request the scopes in the initial redirection. You can specify multiple scopes by separating them by a comma.\n~~~\nhttps://github.com/login/oauth/authorize?\n  client_id=...&\n  scope=user,public_repo\n~~~\n]]--\n\n-- Redirect users to request GitHub access --\nfunction GithubAPI.OAuth.getToken(client_id, scope, callback)\n\tGithubAPI.http_request(\"https://github.com/login/oauth/authorize?client_id=\"..client_id..\"&scope=\"..scope, function(data, status, headers)\n\t\tGithubAPI.OAuth._getToken(client_id, client_secret, data, callback)\n\tend, nil, true)\nend\n-- GitHub redirects back to your site --\nfunction GithubAPI.OAuth._getToken(client_id, client_secret, code, callback)\n\tGithubAPI.http_request(\"https://github.com/login/oauth/access_token\", callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tclient_id = client_id,\n\t\t\tclient_secret = client_secret,\n\t\t\tcode = code\n\t\t}\n\t}, true)\nend\n\n-- List your authorizations --\nfunction GithubAPI.OAuth.authorizations.list(callback)\n\tGithubAPI.http_request(\"authorizations\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nLink: <https://api.github.com/resource?page=2>; rel=\"next\",\n      <https://api.github.com/resource?page=5>; rel=\"last\"\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"id\": 1,\n    \"url\": \"https://api.github.com/authorizations/1\",\n    \"scopes\": [\n      \"public_repo\"\n    ],\n    \"token\": \"abc123\",\n    \"app\": {\n      \"url\": \"http://my-github-app.com\",\n      \"name\": \"my github app\",\n      \"client_id\": \"abcde12345fghij67890\"\n    },\n    \"note\": \"optional note\",\n    \"note_url\": \"http://optional/note/url\",\n    \"updated_at\": \"2011-09-06T20:39:23Z\",\n    \"created_at\": \"2011-09-06T17:26:27Z\"\n  }\n]\n]]--\n\n-- Get a single authorization --\nfunction GithubAPI.OAuth.authorizations.get(id, callback)\n\tGithubAPI.http_request(\"authorizations/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/authorizations/1\",\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"token\": \"abc123\",\n  \"app\": {\n    \"url\": \"http://my-github-app.com\",\n    \"name\": \"my github app\",\n    \"client_id\": \"abcde12345fghij67890\"\n  },\n  \"note\": \"optional note\",\n  \"note_url\": \"http://optional/note/url\",\n  \"updated_at\": \"2011-09-06T20:39:23Z\",\n  \"created_at\": \"2011-09-06T17:26:27Z\"\n}\n]]--\n\n-- Create a new authorization --\nfunction GithubAPI.OAuth.authorizations.create(callback, scopes, note, note_url, client_id, client_secret)\n\tGithubAPI.http_request(\"authorizations/\", callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tscopes = scopes,\n\t\t\tnote = note,\n\t\t\tnote_url = note_url,\n\t\t\tclient_id = client_id,\n\t\t\tclient_secret = client_secret\n\t\t}\n\t})\nend\n\n--[[ Input --\nscopes\nOptional array - A list of scopes that this authorization is in.\n\nnote\nOptional string - A note to remind you what the OAuth token is for.\n\nnote_url\nOptional string - A URL to remind you what app the OAuth token is for.\n\nclient_id\nOptional String - The 20 character OAuth app client key for which to create the token.\n\nclient_secret\nOptional String - The 40 character OAuth app client secret for which to create the token.\n~~~\n{\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"note\": \"admin script\"\n}\n~~~\n]]--\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/authorizations/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/authorizations/1\",\n  \"scopes\": [\n    \"public_repo\"\n  ],\n  \"token\": \"abc123\",\n  \"app\": {\n    \"url\": \"http://my-github-app.com\",\n    \"name\": \"my github app\",\n    \"client_id\": \"abcde12345fghij67890\"\n  },\n  \"note\": \"optional note\",\n  \"note_url\": \"http://optional/note/url\",\n  \"updated_at\": \"2011-09-06T20:39:23Z\",\n  \"created_at\": \"2011-09-06T17:26:27Z\"\n}\n]]--\n\n-- TODO\n-- Update\n-- Check\n-- Delete\n\n--- GISTS ---\n\n-- List gists --\nfunction GithubAPI.gist.list.user(user, callback)\n\tGithubAPI.http_request(\"users/\"..user..\"/gists\", callback)\nend\nfunction GithubAPI.gist.list.all(callback) -- return all public gists if called anonymously\n\tGithubAPI.http_request(\"gists\", callback)\nend\nfunction GithubAPI.gist.list.allPublic(callback)\n\tGithubAPI.http_request(\"gists/public\", callback)\nend\nfunction GithubAPI.gist.list.starred(callback)\n\tGithubAPI.http_request(\"gists/starred\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nLink: <https://api.github.com/resource?page=2>; rel=\"next\",\n      <https://api.github.com/resource?page=5>; rel=\"last\"\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n    \"id\": \"1\",\n    \"description\": \"description of gist\",\n    \"public\": true,\n    \"user\": {\n      \"login\": \"octocat\",\n      \"id\": 1,\n      \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n      \"gravatar_id\": \"somehexcode\",\n      \"url\": \"https://api.github.com/users/octocat\"\n    },\n    \"files\": {\n      \"ring.erl\": {\n        \"size\": 932,\n        \"filename\": \"ring.erl\",\n        \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n      }\n    },\n    \"comments\": 0,\n    \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n    \"html_url\": \"https://gist.github.com/1\",\n    \"git_pull_url\": \"git://gist.github.com/1.git\",\n    \"git_push_url\": \"git@gist.github.com:1.git\",\n    \"created_at\": \"2010-04-14T02:15:15Z\"\n  }\n]\n]]--\n\n-- Get a single gist --\nfunction GithubAPI.gist.get(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Create a gist --\nfunction GithubAPI.gist.create(public, files, callback ,description)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tpublic = public,\n\t\t\tfiles = files,\n\t\t\tdescription = description\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"description\": \"the description for this gist\",\n  \"public\": true,\n  \"files\": {\n    \"file1.txt\": {\n      \"content\": \"String file contents\"\n    }\n  }\n}\n]]--\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Edit a gist --\nfunction GithubAPI.gist.edit(id, files, callback, description)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {\n\t\tmethod = \"PATCH\",\n\t\tdata = {\n\t\t\tid = id,\n\t\t\tfiles = files,\n\t\t\tdescription = description\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"description\": \"the description for this gist\",\n  \"files\": {\n    \"file1.txt\": {\n      \"content\": \"updated file contents\"\n    },\n    \"old_name.txt\": {\n      \"filename\": \"new_name.txt\",\n      \"content\": \"modified contents\"\n    },\n    \"new_file.txt\": {\n      \"content\": \"a new file\"\n    },\n    \"delete_this_file.txt\": null\n  }\n}\n]]--\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\",\n  \"forks\": [\n    {\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"url\": \"https://api.github.com/gists/add0d71b065f55c46f60\",\n      \"created_at\": \"2011-04-14T16:00:49Z\"\n    }\n  ],\n  \"history\": [\n    {\n      \"url\": \"https://api.github.com/gists/80bdb0d081c447600e18\",\n      \"version\": \"57a7f021a713b1c5a6a199b54cc514735d2d462f\",\n      \"user\": {\n        \"login\": \"octocat\",\n        \"id\": 1,\n        \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n        \"gravatar_id\": \"somehexcode\",\n        \"url\": \"https://api.github.com/users/octocat\"\n      },\n      \"change_status\": {\n        \"deletions\": 0,\n        \"additions\": 180,\n        \"total\": 180\n      },\n      \"committed_at\": \"2010-04-14T02:15:15Z\"\n    }\n  ]\n}\n]]--\n\n-- Star a gist --\nfunction GithubAPI.gist.star(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback, {method=\"PUT\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Unstar a gist --\nfunction GithubAPI.gist.unstar(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback, {method=\"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Check if a gist is starred --\nfunction GithubAPI.gist.checkStar(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/star\", callback)\nend\n\n--[[\n-- Response if gist is starred --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n\n-- Response if gist is not starred --\nStatus: 404 Not Found\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n-- Fork a gist --\nfunction GithubAPI.gist.fork(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id..\"/forks\", callback, {method=\"POST\"})\nend\n\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/2\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"url\": \"https://api.github.com/gists/88a3112be74ba6ad701e\",\n  \"id\": \"1\",\n  \"description\": \"description of gist\",\n  \"public\": true,\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"files\": {\n    \"ring.erl\": {\n      \"size\": 932,\n      \"filename\": \"ring.erl\",\n      \"raw_url\": \"https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl\"\n    }\n  },\n  \"comments\": 0,\n  \"comments_url\": \"https://api.github.com/gists/8438e99468ee9a4ab10e/comments/\",\n  \"html_url\": \"https://gist.github.com/1\",\n  \"git_pull_url\": \"git://gist.github.com/1.git\",\n  \"git_push_url\": \"git@gist.github.com:1.git\",\n  \"created_at\": \"2010-04-14T02:15:15Z\"\n}\n]]--\n\n-- Delete a gist --\nfunction GithubAPI.gist.delete(id, callback)\n\tGithubAPI.http_request(\"gists/\"..id, callback, {method=\"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n--- GISTS COMMENTS ---\n\n-- List comments on a gist --\nfunction GithubAPI.gist.comment.list(gist_id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments\", callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n[\n  {\n    \"id\": 1,\n    \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n    \"body\": \"Just commenting for the sake of commenting\",\n    \"user\": {\n      \"login\": \"octocat\",\n      \"id\": 1,\n      \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n      \"gravatar_id\": \"somehexcode\",\n      \"url\": \"https://api.github.com/users/octocat\"\n    },\n    \"created_at\": \"2011-04-18T23:23:56Z\"\n  }\n]\n]]--\n\n-- Get a single comment --\nfunction GithubAPI.gist.comment.get(gist_id, id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback)\nend\n\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Create a comment --\nfunction GithubAPI.gist.comment.create(gist_id, body, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {\n\t\tmethod = \"POST\",\n\t\tdata = {\n\t\t\tbody = body\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"body\": \"Just commenting for the sake of commenting\"\n}\n]]--\n--[[ Response --\nStatus: 201 Created\nLocation: https://api.github.com/gists/comments/1\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Edit a comment --\nfunction GithubAPI.gist.comment.edit(gist_id, id, body, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {\n\t\tmethod = \"PATCH\",\n\t\tdata = {\n\t\t\tbody = body\n\t\t}\n\t})\nend\n\n--[[ Input --\n{\n  \"body\": \"Just commenting for the sake of commenting\"\n}\n]]--\n--[[ Response --\nStatus: 200 OK\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n{\n  \"id\": 1,\n  \"url\": \"https://api.github.com/gists/ae709e9cf889e485e65f/comments/1\",\n  \"body\": \"Just commenting for the sake of commenting\",\n  \"user\": {\n    \"login\": \"octocat\",\n    \"id\": 1,\n    \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n    \"gravatar_id\": \"somehexcode\",\n    \"url\": \"https://api.github.com/users/octocat\"\n  },\n  \"created_at\": \"2011-04-18T23:23:56Z\"\n}\n]]--\n\n-- Delete a comment --\nfunction GithubAPI.gist.comment.delete(gist_id, id, callback)\n\tGithubAPI.http_request(\"gists/..\"gist_id\"../comments/\"..id, callback, {method = \"DELETE\"})\nend\n\n--[[ Response --\nStatus: 204 No Content\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\n]]--\n\n----------------------------------------------------------------------------\n-------------------------------- TOOLS -------------------------------------\n----------------------------------------------------------------------------\n\nfunction GithubAPI.http_request(url, callback, opts, fullUrl)\n\topts = opts or {}\n\t-- if GithubAPI.token then opts.headers = TOKEN BEARER\n\tif opts.data then opts.data = json.encode(opts.data) end\n\n\tlocal _url\n\tif (fullUrl) then _url = url else _url = GithubAPI.location .. url end\n\n\thttp.request(_url, function(data, status, headers)\n\t\tif (status == 500) then error(\"Github: Internal Server Error ...\") end\n\t\tdata = json.decode(data)\n\t\tcallback(data, status, headers)\n\tend, alert, opts)\nend\n\nfunction GithubAPI.explode(div,str) -- credit: http://richard.warburton.it\n  if (div=='') then return false end\n  local pos,arr = 0,{}\n  for st,sp in function() return string.find(str,div,pos,true) end do\n    table.insert(arr,string.sub(str,pos,st-1))\n    pos = sp + 1\n  end\n  table.insert(arr,string.sub(str,pos))\n  return arr\nend\n\n-- GITHUB TIMESTAMP (YYYY-MM-DDTHH:MM:SSZ) to os.time\nfunction GithubAPI.gtimestamp(githubTime)\n\tgithubTime = githubTime:sub(1, #githubTime-1) -- remove Z\n\tgithubTime = GithubAPI.explode(\"T\", githubTime)\n\tgithubTime[1] = GithubAPI.explode(\"-\", githubTime[1])\n\tgithubTime[2] = GithubAPI.explode(\":\", githubTime[2])\n\treturn os.time({\n\t\tyear = tonumber(githubTime[1][1]),\n\t\tmonth = tonumber(githubTime[1][2]),\n\t\tday = tonumber(githubTime[1][3]),\n\t\thour = tonumber(githubTime[2][1]),\n\t\tmin = tonumber(githubTime[2][2]),\n\t\tsec = tonumber(githubTime[2][3])\n\t})\nend"}},"public":true,"created_at":"2013-08-21T16:28:24Z","updated_at":"2013-08-21T16:28:24Z","description":"Github API","comments":0,"user":null,"comments_url":"https://api.github.com/gists/6296732/comments","owner":{"login":"jacquev6","id":327146,"avatar_url":"https://avatars.githubusercontent.com/u/327146?","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"fork_of":{"url":"https://api.github.com/gists/6296553","forks_url":"https://api.github.com/gists/6296553/forks","commits_url":"https://api.github.com/gists/6296553/commits","id":"6296553","git_pull_url":"https://gist.github.com/6296553.git","git_push_url":"https://gist.github.com/6296553.git","html_url":"https://gist.github.com/6296553","files":{},"public":true,"created_at":"2013-08-21T16:12:27Z","updated_at":"2013-10-23T14:58:31Z","description":"Github API","comments":0,"user":null,"comments_url":"https://api.github.com/gists/6296553/comments","owner":{"login":"HyroVitalyProtago","id":3470988,"avatar_url":"https://avatars.githubusercontent.com/u/3470988?","gravatar_id":"ed59562b231a649345f38703948f76f4","url":"https://api.github.com/users/HyroVitalyProtago","html_url":"https://github.com/HyroVitalyProtago","followers_url":"https://api.github.com/users/HyroVitalyProtago/followers","following_url":"https://api.github.com/users/HyroVitalyProtago/following{/other_user}","gists_url":"https://api.github.com/users/HyroVitalyProtago/gists{/gist_id}","starred_url":"https://api.github.com/users/HyroVitalyProtago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyroVitalyProtago/subscriptions","organizations_url":"https://api.github.com/users/HyroVitalyProtago/orgs","repos_url":"https://api.github.com/users/HyroVitalyProtago/repos","events_url":"https://api.github.com/users/HyroVitalyProtago/events{/privacy}","received_events_url":"https://api.github.com/users/HyroVitalyProtago/received_events","type":"User","site_admin":false}},"forks":[],"history":[{"user":null,"version":"c464aecd7fea16684e935607eeea7ae4f8caa0e2","committed_at":"2013-08-21T16:12:27Z","change_status":{"total":793,"additions":793,"deletions":0},"url":"https://api.github.com/gists/6296732/c464aecd7fea16684e935607eeea7ae4f8caa0e2"}]}

