{"action":"created","comment":{"url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/comments/72993785","id":72993785,"diff_hunk":"@@ -285,33 +255,35 @@ def on_data(self, data):\n                         break\n                     else:\n                         return True\n-                # TODO: http://vk.cc/5raROT\n-                geo_tweet = '\\n\\t{ \"type\": \"Geotweet\", \\n\\t\\t\"geometry\":\\n\\t\\t\\t'\n+\n+                geo_tweet = collections.OrderedDict({})\n+                geo_tweet['type'] = 'Geotweet'\n+\n                 if not jdata['geo']:  # Place\n                     # Change Polygon to Point\n                     coordinates = jdata['place']['bounding_box']['coordinates'][0]\n                     lon = (coordinates[0][0] + coordinates[2][0]) / 2\n                     lat = (coordinates[0][1] + coordinates[2][1]) / 2\n-                    geo_tweet += '{\"type\": \"Point\", \"coordinates\": [' + str(lon) + ', ' + str(lat) + ']}'\n+                    geo_tweet['geometry'] = {'type': 'Point', 'coordinates': [lon, lat]}\n                 else:  # Geo\n-                    geo_tweet += str(jdata['geo']).replace(\"u'\", '\"').replace(\"'\", '\"')\n+                    geo_tweet['geometry'] = jdata['geo']\n \n                 # Add metadata which user choose\n-                geo_tweet += ',\\n\\t\\t\"properties\": \\n\\t\\t\\t'\n-                if output_metadata == 'Minimum (created_at, text, coordinates)':\n-                    min_data = '\"created_at\":\"' + str(jdata['created_at']) + '\",' + \\\n-                                '\"text\":\"' + str(jdata['text'].encode('utf-8'))\\\n-                                .replace('\"', \"'\").replace('\\\\', '\\\\\\\\') + '\"'  # crutch-escape characters\n-                    geo_tweet += '{' + min_data + '}\\n'\n-                elif output_metadata == 'All (need more RAM / big files)':\n-                    geo_tweet += data\n-                elif output_metadata == 'None - Only coordinates':\n-                    geo_tweet += '{}'\n-                geo_tweet += '\\t}'\n+                if output_metadata == 'min':\n+                    min_data = collections.OrderedDict({})\n+                    min_data['created_at'] = str(jdata['created_at'])\n+                    min_data['text'] = jdata['text']\n+                    geo_tweet['properties'] = min_data\n+                elif output_metadata == 'all':\n+                    geo_tweet['properties'] = jdata\n+\n+                elif output_metadata == 'none':\n+                    geo_tweet['properties'] = {}\n \n                 if output_GeoJSON:\n                     with open(file_name + '.geojson', 'a') as file:","path":"Tweets.py","position":224,"original_position":224,"commit_id":"cd2a0701bfb4ec86e1dea7ac719ff461e31b5f1b","original_commit_id":"cd2a0701bfb4ec86e1dea7ac719ff461e31b5f1b","user":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"body":"Ok","created_at":"2016-08-01T15:04:33Z","updated_at":"2016-08-01T15:04:33Z","html_url":"https://github.com/MaxymVlasov/Tweets/pull/1#discussion_r72993785","pull_request_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/comments/72993785"},"html":{"href":"https://github.com/MaxymVlasov/Tweets/pull/1#discussion_r72993785"},"pull_request":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1","id":79566030,"html_url":"https://github.com/MaxymVlasov/Tweets/pull/1","diff_url":"https://github.com/MaxymVlasov/Tweets/pull/1.diff","patch_url":"https://github.com/MaxymVlasov/Tweets/pull/1.patch","issue_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/1","number":1,"state":"open","locked":false,"title":"Refactoring","user":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-01T13:14:06Z","updated_at":"2016-08-01T15:04:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bc52be859edb7c30918bdf2cc4624e4bb625b35","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1/commits","review_comments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1/comments","review_comment_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/1/comments","statuses_url":"https://api.github.com/repos/MaxymVlasov/Tweets/statuses/cd2a0701bfb4ec86e1dea7ac719ff461e31b5f1b","head":{"label":"MaxymVlasov:Refactoring","ref":"Refactoring","sha":"cd2a0701bfb4ec86e1dea7ac719ff461e31b5f1b","user":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"repo":{"id":64101405,"name":"Tweets","full_name":"MaxymVlasov/Tweets","owner":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MaxymVlasov/Tweets","description":null,"fork":false,"url":"https://api.github.com/repos/MaxymVlasov/Tweets","forks_url":"https://api.github.com/repos/MaxymVlasov/Tweets/forks","keys_url":"https://api.github.com/repos/MaxymVlasov/Tweets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MaxymVlasov/Tweets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MaxymVlasov/Tweets/teams","hooks_url":"https://api.github.com/repos/MaxymVlasov/Tweets/hooks","issue_events_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/events{/number}","events_url":"https://api.github.com/repos/MaxymVlasov/Tweets/events","assignees_url":"https://api.github.com/repos/MaxymVlasov/Tweets/assignees{/user}","branches_url":"https://api.github.com/repos/MaxymVlasov/Tweets/branches{/branch}","tags_url":"https://api.github.com/repos/MaxymVlasov/Tweets/tags","blobs_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/refs{/sha}","trees_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MaxymVlasov/Tweets/statuses/{sha}","languages_url":"https://api.github.com/repos/MaxymVlasov/Tweets/languages","stargazers_url":"https://api.github.com/repos/MaxymVlasov/Tweets/stargazers","contributors_url":"https://api.github.com/repos/MaxymVlasov/Tweets/contributors","subscribers_url":"https://api.github.com/repos/MaxymVlasov/Tweets/subscribers","subscription_url":"https://api.github.com/repos/MaxymVlasov/Tweets/subscription","commits_url":"https://api.github.com/repos/MaxymVlasov/Tweets/commits{/sha}","git_commits_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/commits{/sha}","comments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/comments{/number}","issue_comment_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/comments{/number}","contents_url":"https://api.github.com/repos/MaxymVlasov/Tweets/contents/{+path}","compare_url":"https://api.github.com/repos/MaxymVlasov/Tweets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MaxymVlasov/Tweets/merges","archive_url":"https://api.github.com/repos/MaxymVlasov/Tweets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MaxymVlasov/Tweets/downloads","issues_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues{/number}","pulls_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls{/number}","milestones_url":"https://api.github.com/repos/MaxymVlasov/Tweets/milestones{/number}","notifications_url":"https://api.github.com/repos/MaxymVlasov/Tweets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MaxymVlasov/Tweets/labels{/name}","releases_url":"https://api.github.com/repos/MaxymVlasov/Tweets/releases{/id}","deployments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/deployments","created_at":"2016-07-25T03:38:42Z","updated_at":"2016-07-25T04:42:03Z","pushed_at":"2016-08-01T14:06:32Z","git_url":"git://github.com/MaxymVlasov/Tweets.git","ssh_url":"git@github.com:MaxymVlasov/Tweets.git","clone_url":"https://github.com/MaxymVlasov/Tweets.git","svn_url":"https://github.com/MaxymVlasov/Tweets","homepage":null,"size":42,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"MaxymVlasov:master","ref":"master","sha":"b8c20b512038d8ddb0232883660459b2dfc5f23b","user":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"repo":{"id":64101405,"name":"Tweets","full_name":"MaxymVlasov/Tweets","owner":{"login":"MaxymVlasov","id":11096782,"avatar_url":"https://avatars.githubusercontent.com/u/11096782?v=3","gravatar_id":"","url":"https://api.github.com/users/MaxymVlasov","html_url":"https://github.com/MaxymVlasov","followers_url":"https://api.github.com/users/MaxymVlasov/followers","following_url":"https://api.github.com/users/MaxymVlasov/following{/other_user}","gists_url":"https://api.github.com/users/MaxymVlasov/gists{/gist_id}","starred_url":"https://api.github.com/users/MaxymVlasov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaxymVlasov/subscriptions","organizations_url":"https://api.github.com/users/MaxymVlasov/orgs","repos_url":"https://api.github.com/users/MaxymVlasov/repos","events_url":"https://api.github.com/users/MaxymVlasov/events{/privacy}","received_events_url":"https://api.github.com/users/MaxymVlasov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MaxymVlasov/Tweets","description":null,"fork":false,"url":"https://api.github.com/repos/MaxymVlasov/Tweets","forks_url":"https://api.github.com/repos/MaxymVlasov/Tweets/forks","keys_url":"https://api.github.com/repos/MaxymVlasov/Tweets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MaxymVlasov/Tweets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MaxymVlasov/Tweets/teams","hooks_url":"https://api.github.com/repos/MaxymVlasov/Tweets/hooks","issue_events_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/events{/number}","events_url":"https://api.github.com/repos/MaxymVlasov/Tweets/events","assignees_url":"https://api.github.com/repos/MaxymVlasov/Tweets/assignees{/user}","branches_url":"https://api.github.com/repos/MaxymVlasov/Tweets/branches{/branch}","tags_url":"https://api.github.com/repos/MaxymVlasov/Tweets/tags","blobs_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/refs{/sha}","trees_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MaxymVlasov/Tweets/statuses/{sha}","languages_url":"https://api.github.com/repos/MaxymVlasov/Tweets/languages","stargazers_url":"https://api.github.com/repos/MaxymVlasov/Tweets/stargazers","contributors_url":"https://api.github.com/repos/MaxymVlasov/Tweets/contributors","subscribers_url":"https://api.github.com/repos/MaxymVlasov/Tweets/subscribers","subscription_url":"https://api.github.com/repos/MaxymVlasov/Tweets/subscription","commits_url":"https://api.github.com/repos/MaxymVlasov/Tweets/commits{/sha}","git_commits_url":"https://api.github.com/repos/MaxymVlasov/Tweets/git/commits{/sha}","comments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/comments{/number}","issue_comment_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/comments{/number}","contents_url":"https://api.github.com/repos/MaxymVlasov/Tweets/contents/{+path}","compare_url":"https://api.github.com/repos/MaxymVlasov/Tweets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MaxymVlasov/Tweets/merges","archive_url":"https://api.github.com/repos/MaxymVlasov/Tweets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MaxymVlasov/Tweets/downloads","issues_url":"https://api.github.com/repos/MaxymVlasov/Tweets/issues{/number}","pulls_url":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls{/number}","milestones_url":"https://api.github.com/repos/MaxymVlasov/Tweets/milestones{/number}","notifications_url":"https://api.github.com/repos/MaxymVlasov/Tweets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MaxymVlasov/Tweets/labels{/name}","releases_url":"https://api.github.com/repos/MaxymVlasov/Tweets/releases{/id}","deployments_url":"https://api.github.com/repos/MaxymVlasov/Tweets/deployments","created_at":"2016-07-25T03:38:42Z","updated_at":"2016-07-25T04:42:03Z","pushed_at":"2016-08-01T14:06:32Z","git_url":"git://github.com/MaxymVlasov/Tweets.git","ssh_url":"git@github.com:MaxymVlasov/Tweets.git","clone_url":"https://github.com/MaxymVlasov/Tweets.git","svn_url":"https://github.com/MaxymVlasov/Tweets","homepage":null,"size":42,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1"},"html":{"href":"https://github.com/MaxymVlasov/Tweets/pull/1"},"issue":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/1"},"comments":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/MaxymVlasov/Tweets/statuses/cd2a0701bfb4ec86e1dea7ac719ff461e31b5f1b"}}}}
{"actor":{"display_login":"MaxymVlasov"}}