{"action":"created","comment":{"url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/comments/44040156","id":44040156,"diff_hunk":"@@ -0,0 +1,75 @@\n+\n+import os\n+\n+from boto.s3.connection import S3Connection\n+from boto.s3.key import Key\n+import click\n+\n+import creds\n+\n+\n+def get_or_create_bucket(conn, bucket_name):\n+    \"\"\"Get or create an S3 bucket.\n+\n+    :param conn: boto.s3.connection.S3Connection\n+    :param bucket_name: string\n+    :returns: boto.s3.bucket.Bucket\n+    \"\"\"\n+    try:\n+        bucket = conn.get_bucket(bucket_name)\n+    except ValueError:\n+        bucket = conn.create_bucket(bucket_name)\n+\n+    return bucket\n+\n+\n+def sizeof_fmt(num):\n+    \"\"\"Human readable file size.\n+\n+    Modified from http://stackoverflow.com/a/1094933/1377021\n+\n+    :param num: float\n+    :returns: string\n+    \"\"\"\n+    for unit in ['', 'k', 'm', 'g', 't', 'p', 'e', 'z']:\n+        if abs(num) < 1024.0:\n+            return \"%.0f%s%s\" % (num, unit, 'b')\n+        num /= 1024.0\n+\n+    return \"%.f%s%s\" % (num, 'y', 'b')\n+\n+\n+@click.command()\n+@click.argument('directory', type=click.Path(exists=True))\n+def upload(directory):\n+    \"\"\"Upload a directory to S3.\n+\n+    DIRECTORY: Directory to upload. Required.\n+    \"\"\"\n+    conn = S3Connection(creds.AWS_ACCESS_KEY_ID, creds.AWS_SECRET_ACCESS_KEY)","path":"scripts/upload.py","position":49,"original_position":49,"commit_id":"18885946afc95b553dcd819d6b20a561da3eb85c","original_commit_id":"18885946afc95b553dcd819d6b20a561da3eb85c","user":{"login":"JesseCrocker","id":2048291,"avatar_url":"https://avatars.githubusercontent.com/u/2048291?v=3","gravatar_id":"","url":"https://api.github.com/users/JesseCrocker","html_url":"https://github.com/JesseCrocker","followers_url":"https://api.github.com/users/JesseCrocker/followers","following_url":"https://api.github.com/users/JesseCrocker/following{/other_user}","gists_url":"https://api.github.com/users/JesseCrocker/gists{/gist_id}","starred_url":"https://api.github.com/users/JesseCrocker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JesseCrocker/subscriptions","organizations_url":"https://api.github.com/users/JesseCrocker/orgs","repos_url":"https://api.github.com/users/JesseCrocker/repos","events_url":"https://api.github.com/users/JesseCrocker/events{/privacy}","received_events_url":"https://api.github.com/users/JesseCrocker/received_events","type":"User","site_admin":false},"body":"I think it would be better to not specify the credentials, and just stick to using the default boto credential loading mechanisms.","created_at":"2015-11-05T17:20:55Z","updated_at":"2015-11-05T17:20:55Z","html_url":"https://github.com/trailbehind/OpenHuntingData/pull/25#discussion_r44040156","pull_request_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/comments/44040156"},"html":{"href":"https://github.com/trailbehind/OpenHuntingData/pull/25#discussion_r44040156"},"pull_request":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25","id":49784162,"html_url":"https://github.com/trailbehind/OpenHuntingData/pull/25","diff_url":"https://github.com/trailbehind/OpenHuntingData/pull/25.diff","patch_url":"https://github.com/trailbehind/OpenHuntingData/pull/25.patch","issue_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/25","number":25,"state":"open","locked":false,"title":"S3 upload script","user":{"login":"nathancahill","id":1383872,"avatar_url":"https://avatars.githubusercontent.com/u/1383872?v=3","gravatar_id":"","url":"https://api.github.com/users/nathancahill","html_url":"https://github.com/nathancahill","followers_url":"https://api.github.com/users/nathancahill/followers","following_url":"https://api.github.com/users/nathancahill/following{/other_user}","gists_url":"https://api.github.com/users/nathancahill/gists{/gist_id}","starred_url":"https://api.github.com/users/nathancahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathancahill/subscriptions","organizations_url":"https://api.github.com/users/nathancahill/orgs","repos_url":"https://api.github.com/users/nathancahill/repos","events_url":"https://api.github.com/users/nathancahill/events{/privacy}","received_events_url":"https://api.github.com/users/nathancahill/received_events","type":"User","site_admin":false},"body":"Depends on #23.","created_at":"2015-11-05T05:32:53Z","updated_at":"2015-11-05T17:20:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93c69859d065f67a2fd0c390a2db1b380a33257e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25/commits","review_comments_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25/comments","review_comment_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/comments{/number}","comments_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/25/comments","statuses_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/statuses/18885946afc95b553dcd819d6b20a561da3eb85c","head":{"label":"nathancahill:s3-upload","ref":"s3-upload","sha":"18885946afc95b553dcd819d6b20a561da3eb85c","user":{"login":"nathancahill","id":1383872,"avatar_url":"https://avatars.githubusercontent.com/u/1383872?v=3","gravatar_id":"","url":"https://api.github.com/users/nathancahill","html_url":"https://github.com/nathancahill","followers_url":"https://api.github.com/users/nathancahill/followers","following_url":"https://api.github.com/users/nathancahill/following{/other_user}","gists_url":"https://api.github.com/users/nathancahill/gists{/gist_id}","starred_url":"https://api.github.com/users/nathancahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathancahill/subscriptions","organizations_url":"https://api.github.com/users/nathancahill/orgs","repos_url":"https://api.github.com/users/nathancahill/repos","events_url":"https://api.github.com/users/nathancahill/events{/privacy}","received_events_url":"https://api.github.com/users/nathancahill/received_events","type":"User","site_admin":false},"repo":{"id":45557773,"name":"OpenHuntingData","full_name":"nathancahill/OpenHuntingData","owner":{"login":"nathancahill","id":1383872,"avatar_url":"https://avatars.githubusercontent.com/u/1383872?v=3","gravatar_id":"","url":"https://api.github.com/users/nathancahill","html_url":"https://github.com/nathancahill","followers_url":"https://api.github.com/users/nathancahill/followers","following_url":"https://api.github.com/users/nathancahill/following{/other_user}","gists_url":"https://api.github.com/users/nathancahill/gists{/gist_id}","starred_url":"https://api.github.com/users/nathancahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathancahill/subscriptions","organizations_url":"https://api.github.com/users/nathancahill/orgs","repos_url":"https://api.github.com/users/nathancahill/repos","events_url":"https://api.github.com/users/nathancahill/events{/privacy}","received_events_url":"https://api.github.com/users/nathancahill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nathancahill/OpenHuntingData","description":"A set of scripts to gather public geo-data for making hunting maps.","fork":true,"url":"https://api.github.com/repos/nathancahill/OpenHuntingData","forks_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/forks","keys_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/teams","hooks_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/hooks","issue_events_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/issues/events{/number}","events_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/events","assignees_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/assignees{/user}","branches_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/branches{/branch}","tags_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/tags","blobs_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/git/refs{/sha}","trees_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/statuses/{sha}","languages_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/languages","stargazers_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/stargazers","contributors_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/contributors","subscribers_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/subscribers","subscription_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/subscription","commits_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/commits{/sha}","git_commits_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/git/commits{/sha}","comments_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/comments{/number}","issue_comment_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/issues/comments{/number}","contents_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/contents/{+path}","compare_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/merges","archive_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/downloads","issues_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/issues{/number}","pulls_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/pulls{/number}","milestones_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/milestones{/number}","notifications_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/labels{/name}","releases_url":"https://api.github.com/repos/nathancahill/OpenHuntingData/releases{/id}","created_at":"2015-11-04T18:10:12Z","updated_at":"2015-11-03T15:59:45Z","pushed_at":"2015-11-05T07:05:19Z","git_url":"git://github.com/nathancahill/OpenHuntingData.git","ssh_url":"git@github.com:nathancahill/OpenHuntingData.git","clone_url":"https://github.com/nathancahill/OpenHuntingData.git","svn_url":"https://github.com/nathancahill/OpenHuntingData","homepage":null,"size":280,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"trailbehind:master","ref":"master","sha":"acd74b795690cd5128c3b8bae544a33e968d1aea","user":{"login":"trailbehind","id":113243,"avatar_url":"https://avatars.githubusercontent.com/u/113243?v=3","gravatar_id":"","url":"https://api.github.com/users/trailbehind","html_url":"https://github.com/trailbehind","followers_url":"https://api.github.com/users/trailbehind/followers","following_url":"https://api.github.com/users/trailbehind/following{/other_user}","gists_url":"https://api.github.com/users/trailbehind/gists{/gist_id}","starred_url":"https://api.github.com/users/trailbehind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trailbehind/subscriptions","organizations_url":"https://api.github.com/users/trailbehind/orgs","repos_url":"https://api.github.com/users/trailbehind/repos","events_url":"https://api.github.com/users/trailbehind/events{/privacy}","received_events_url":"https://api.github.com/users/trailbehind/received_events","type":"Organization","site_admin":false},"repo":{"id":44562469,"name":"OpenHuntingData","full_name":"trailbehind/OpenHuntingData","owner":{"login":"trailbehind","id":113243,"avatar_url":"https://avatars.githubusercontent.com/u/113243?v=3","gravatar_id":"","url":"https://api.github.com/users/trailbehind","html_url":"https://github.com/trailbehind","followers_url":"https://api.github.com/users/trailbehind/followers","following_url":"https://api.github.com/users/trailbehind/following{/other_user}","gists_url":"https://api.github.com/users/trailbehind/gists{/gist_id}","starred_url":"https://api.github.com/users/trailbehind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trailbehind/subscriptions","organizations_url":"https://api.github.com/users/trailbehind/orgs","repos_url":"https://api.github.com/users/trailbehind/repos","events_url":"https://api.github.com/users/trailbehind/events{/privacy}","received_events_url":"https://api.github.com/users/trailbehind/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/trailbehind/OpenHuntingData","description":"A set of scripts to gather public geo-data for making hunting maps.","fork":false,"url":"https://api.github.com/repos/trailbehind/OpenHuntingData","forks_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/forks","keys_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/teams","hooks_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/hooks","issue_events_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/events{/number}","events_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/events","assignees_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/assignees{/user}","branches_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/branches{/branch}","tags_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/tags","blobs_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/git/refs{/sha}","trees_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/statuses/{sha}","languages_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/languages","stargazers_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/stargazers","contributors_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/contributors","subscribers_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/subscribers","subscription_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/subscription","commits_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/commits{/sha}","git_commits_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/git/commits{/sha}","comments_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/comments{/number}","issue_comment_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/comments{/number}","contents_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/contents/{+path}","compare_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/merges","archive_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/downloads","issues_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues{/number}","pulls_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls{/number}","milestones_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/milestones{/number}","notifications_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/labels{/name}","releases_url":"https://api.github.com/repos/trailbehind/OpenHuntingData/releases{/id}","created_at":"2015-10-19T20:36:51Z","updated_at":"2015-11-03T15:59:45Z","pushed_at":"2015-11-05T05:59:12Z","git_url":"git://github.com/trailbehind/OpenHuntingData.git","ssh_url":"git@github.com:trailbehind/OpenHuntingData.git","clone_url":"https://github.com/trailbehind/OpenHuntingData.git","svn_url":"https://github.com/trailbehind/OpenHuntingData","homepage":null,"size":280,"stargazers_count":7,"watchers_count":7,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":11,"forks":5,"open_issues":11,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25"},"html":{"href":"https://github.com/trailbehind/OpenHuntingData/pull/25"},"issue":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/25"},"comments":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/trailbehind/OpenHuntingData/statuses/18885946afc95b553dcd819d6b20a561da3eb85c"}}}}