https
GET
api.github.com
None
/gists/6296553
{'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python'}
None
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '25285'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 21 Aug 2013 16:26:50 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"b96b3895f5da8f5e9533f0db72748a49"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 21 Aug 2013 16:28:20 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1377104997')]
{"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":{"GithubAPI.lua":{"filename":"GithubAPI.lua","type":"text/plain","language":"Lua","raw_url":"https://gist.github.com/raw/6296553/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:12:27Z","updated_at":"2013-08-21T16:26:50Z","description":"Github API","comments":0,"user":{"login":"HyroVitalyProtago","id":3470988,"avatar_url":"https://2.gravatar.com/avatar/ed59562b231a649345f38703948f76f4?d=https%3A%2F%2Fidenticons.github.com%2F6582cb986b7a730b12f7c18dfcc865f0.png","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"},"comments_url":"https://api.github.com/gists/6296553/comments","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/6296553/c464aecd7fea16684e935607eeea7ae4f8caa0e2"}]}

https
POST
api.github.com
None
/gists/6296553/forks
{'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python'}
None
201
[('status', '201 Created'), ('x-ratelimit-remaining', '4965'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('cache-control', 'max-age=0, private, must-revalidate'), ('content-length', '1510'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/gists/6296732'), ('access-control-allow-credentials', 'true'), ('date', 'Wed, 21 Aug 2013 16:28:24 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('etag', '"ceb086d4f395719d1124cade5cedbfd4"'), ('x-ratelimit-reset', '1377104997')]
{"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":{},"public":true,"created_at":"2013-08-21T16:28:24Z","updated_at":"2013-08-21T16:28:24Z","description":"Github API","comments":0,"user":{"login":"jacquev6","id":327146,"avatar_url":"https://1.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https%3A%2F%2Fidenticons.github.com%2Ffadfb5f7088ef66579d198a3c9a4935e.png","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"},"comments_url":"https://api.github.com/gists/6296732/comments"}

https
GET
api.github.com
None
/gists/6296732
{'Authorization': 'token private_token_removed', 'User-Agent': 'PyGithub/Python'}
None
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4964'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '26806'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 21 Aug 2013 16:28:24 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"f2916c23435522156274bed022a322e7"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 21 Aug 2013 16:28:25 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1377104997')]
{"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.github.com/raw/6296732/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":{"login":"jacquev6","id":327146,"avatar_url":"https://2.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https%3A%2F%2Fidenticons.github.com%2Ffadfb5f7088ef66579d198a3c9a4935e.png","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"},"comments_url":"https://api.github.com/gists/6296732/comments","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"}],"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-08-21T16:28:24Z","description":"Github API","comments":0,"user":{"login":"HyroVitalyProtago","id":3470988,"avatar_url":"https://1.gravatar.com/avatar/ed59562b231a649345f38703948f76f4?d=https%3A%2F%2Fidenticons.github.com%2F6582cb986b7a730b12f7c18dfcc865f0.png","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"},"comments_url":"https://api.github.com/gists/6296553/comments"}}
