{"action":"created","comment":{"url":"https://api.github.com/repos/carmelre/python_training/pulls/comments/184383672","pull_request_review_id":115557234,"id":184383672,"diff_hunk":"@@ -0,0 +1,36 @@\n+import docker\n+import redis\n+import time\n+\n+CLIENT = docker.from_env()\n+DEFAULT_PORT = 6379\n+DEFAULT_CONTAINER_NAME = 'redis'\n+IMAGE_NAME = 'redis'\n+CONNECTION_ATTEMPTS = 3\n+\n+\n+def run_redis(name=None, port=None):\n+    \"\"\"\n+    Runs a redis container and returns a connection to the DB.\n+\n+    :param: name: The name that would be given to the container.\n+    :param: port: The port on localhost that would be bound to the default redis port within the container.\n+    :return: A redis connection.\n+    \"\"\"\n+    container_name = name if name is not None else DEFAULT_CONTAINER_NAME\n+    port = port if port is not None else DEFAULT_PORT\n+    container = CLIENT.containers.run(IMAGE_NAME, ports={f'{DEFAULT_PORT}/tcp': port}, detach=True, name=container_name)\n+    redis_connection = redis.Redis(host='localhost', port=f'{port}')\n+    global CONNECTION_ATTEMPTS","path":"python_training/redis_management.py","position":24,"original_position":24,"commit_id":"bdbb62e47415d8b32d8124e534d96e3f980ea263","original_commit_id":"bdbb62e47415d8b32d8124e534d96e3f980ea263","user":{"login":"AlonSh","id":8265935,"avatar_url":"https://avatars0.githubusercontent.com/u/8265935?v=4","gravatar_id":"","url":"https://api.github.com/users/AlonSh","html_url":"https://github.com/AlonSh","followers_url":"https://api.github.com/users/AlonSh/followers","following_url":"https://api.github.com/users/AlonSh/following{/other_user}","gists_url":"https://api.github.com/users/AlonSh/gists{/gist_id}","starred_url":"https://api.github.com/users/AlonSh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlonSh/subscriptions","organizations_url":"https://api.github.com/users/AlonSh/orgs","repos_url":"https://api.github.com/users/AlonSh/repos","events_url":"https://api.github.com/users/AlonSh/events{/privacy}","received_events_url":"https://api.github.com/users/AlonSh/received_events","type":"User","site_admin":false},"body":"Looks like `CONNECTION_ATTEMPTS` was supposed to be a constant","created_at":"2018-04-26T13:14:24Z","updated_at":"2018-04-26T13:18:55Z","html_url":"https://github.com/carmelre/python_training/pull/12#discussion_r184383672","pull_request_url":"https://api.github.com/repos/carmelre/python_training/pulls/12","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/comments/184383672"},"html":{"href":"https://github.com/carmelre/python_training/pull/12#discussion_r184383672"},"pull_request":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/carmelre/python_training/pulls/12","id":184321857,"html_url":"https://github.com/carmelre/python_training/pull/12","diff_url":"https://github.com/carmelre/python_training/pull/12.diff","patch_url":"https://github.com/carmelre/python_training/pull/12.patch","issue_url":"https://api.github.com/repos/carmelre/python_training/issues/12","number":12,"state":"open","locked":false,"title":"Game of redis","user":{"login":"carmelre","id":33458504,"avatar_url":"https://avatars2.githubusercontent.com/u/33458504?v=4","gravatar_id":"","url":"https://api.github.com/users/carmelre","html_url":"https://github.com/carmelre","followers_url":"https://api.github.com/users/carmelre/followers","following_url":"https://api.github.com/users/carmelre/following{/other_user}","gists_url":"https://api.github.com/users/carmelre/gists{/gist_id}","starred_url":"https://api.github.com/users/carmelre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carmelre/subscriptions","organizations_url":"https://api.github.com/users/carmelre/orgs","repos_url":"https://api.github.com/users/carmelre/repos","events_url":"https://api.github.com/users/carmelre/events{/privacy}","received_events_url":"https://api.github.com/users/carmelre/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-26T12:22:58Z","updated_at":"2018-04-26T13:18:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ec5a14edcd1d4d01303b20d5e6db0f8704353ca","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ofir123","id":4647811,"avatar_url":"https://avatars1.githubusercontent.com/u/4647811?v=4","gravatar_id":"","url":"https://api.github.com/users/ofir123","html_url":"https://github.com/ofir123","followers_url":"https://api.github.com/users/ofir123/followers","following_url":"https://api.github.com/users/ofir123/following{/other_user}","gists_url":"https://api.github.com/users/ofir123/gists{/gist_id}","starred_url":"https://api.github.com/users/ofir123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofir123/subscriptions","organizations_url":"https://api.github.com/users/ofir123/orgs","repos_url":"https://api.github.com/users/ofir123/repos","events_url":"https://api.github.com/users/ofir123/events{/privacy}","received_events_url":"https://api.github.com/users/ofir123/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/carmelre/python_training/pulls/12/commits","review_comments_url":"https://api.github.com/repos/carmelre/python_training/pulls/12/comments","review_comment_url":"https://api.github.com/repos/carmelre/python_training/pulls/comments{/number}","comments_url":"https://api.github.com/repos/carmelre/python_training/issues/12/comments","statuses_url":"https://api.github.com/repos/carmelre/python_training/statuses/bdbb62e47415d8b32d8124e534d96e3f980ea263","head":{"label":"carmelre:game_of_redis","ref":"game_of_redis","sha":"bdbb62e47415d8b32d8124e534d96e3f980ea263","user":{"login":"carmelre","id":33458504,"avatar_url":"https://avatars2.githubusercontent.com/u/33458504?v=4","gravatar_id":"","url":"https://api.github.com/users/carmelre","html_url":"https://github.com/carmelre","followers_url":"https://api.github.com/users/carmelre/followers","following_url":"https://api.github.com/users/carmelre/following{/other_user}","gists_url":"https://api.github.com/users/carmelre/gists{/gist_id}","starred_url":"https://api.github.com/users/carmelre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carmelre/subscriptions","organizations_url":"https://api.github.com/users/carmelre/orgs","repos_url":"https://api.github.com/users/carmelre/repos","events_url":"https://api.github.com/users/carmelre/events{/privacy}","received_events_url":"https://api.github.com/users/carmelre/received_events","type":"User","site_admin":false},"repo":{"id":123942220,"name":"python_training","full_name":"carmelre/python_training","owner":{"login":"carmelre","id":33458504,"avatar_url":"https://avatars2.githubusercontent.com/u/33458504?v=4","gravatar_id":"","url":"https://api.github.com/users/carmelre","html_url":"https://github.com/carmelre","followers_url":"https://api.github.com/users/carmelre/followers","following_url":"https://api.github.com/users/carmelre/following{/other_user}","gists_url":"https://api.github.com/users/carmelre/gists{/gist_id}","starred_url":"https://api.github.com/users/carmelre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carmelre/subscriptions","organizations_url":"https://api.github.com/users/carmelre/orgs","repos_url":"https://api.github.com/users/carmelre/repos","events_url":"https://api.github.com/users/carmelre/events{/privacy}","received_events_url":"https://api.github.com/users/carmelre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carmelre/python_training","description":"Exercises:)","fork":false,"url":"https://api.github.com/repos/carmelre/python_training","forks_url":"https://api.github.com/repos/carmelre/python_training/forks","keys_url":"https://api.github.com/repos/carmelre/python_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carmelre/python_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carmelre/python_training/teams","hooks_url":"https://api.github.com/repos/carmelre/python_training/hooks","issue_events_url":"https://api.github.com/repos/carmelre/python_training/issues/events{/number}","events_url":"https://api.github.com/repos/carmelre/python_training/events","assignees_url":"https://api.github.com/repos/carmelre/python_training/assignees{/user}","branches_url":"https://api.github.com/repos/carmelre/python_training/branches{/branch}","tags_url":"https://api.github.com/repos/carmelre/python_training/tags","blobs_url":"https://api.github.com/repos/carmelre/python_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carmelre/python_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carmelre/python_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/carmelre/python_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carmelre/python_training/statuses/{sha}","languages_url":"https://api.github.com/repos/carmelre/python_training/languages","stargazers_url":"https://api.github.com/repos/carmelre/python_training/stargazers","contributors_url":"https://api.github.com/repos/carmelre/python_training/contributors","subscribers_url":"https://api.github.com/repos/carmelre/python_training/subscribers","subscription_url":"https://api.github.com/repos/carmelre/python_training/subscription","commits_url":"https://api.github.com/repos/carmelre/python_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/carmelre/python_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/carmelre/python_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/carmelre/python_training/issues/comments{/number}","contents_url":"https://api.github.com/repos/carmelre/python_training/contents/{+path}","compare_url":"https://api.github.com/repos/carmelre/python_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carmelre/python_training/merges","archive_url":"https://api.github.com/repos/carmelre/python_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carmelre/python_training/downloads","issues_url":"https://api.github.com/repos/carmelre/python_training/issues{/number}","pulls_url":"https://api.github.com/repos/carmelre/python_training/pulls{/number}","milestones_url":"https://api.github.com/repos/carmelre/python_training/milestones{/number}","notifications_url":"https://api.github.com/repos/carmelre/python_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carmelre/python_training/labels{/name}","releases_url":"https://api.github.com/repos/carmelre/python_training/releases{/id}","deployments_url":"https://api.github.com/repos/carmelre/python_training/deployments","created_at":"2018-03-05T15:50:01Z","updated_at":"2018-03-07T13:55:02Z","pushed_at":"2018-04-26T12:22:58Z","git_url":"git://github.com/carmelre/python_training.git","ssh_url":"git@github.com:carmelre/python_training.git","clone_url":"https://github.com/carmelre/python_training.git","svn_url":"https://github.com/carmelre/python_training","homepage":null,"size":68,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"carmelre:master","ref":"master","sha":"0ef37904fcdc4448d57370a2280fca71d35ff680","user":{"login":"carmelre","id":33458504,"avatar_url":"https://avatars2.githubusercontent.com/u/33458504?v=4","gravatar_id":"","url":"https://api.github.com/users/carmelre","html_url":"https://github.com/carmelre","followers_url":"https://api.github.com/users/carmelre/followers","following_url":"https://api.github.com/users/carmelre/following{/other_user}","gists_url":"https://api.github.com/users/carmelre/gists{/gist_id}","starred_url":"https://api.github.com/users/carmelre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carmelre/subscriptions","organizations_url":"https://api.github.com/users/carmelre/orgs","repos_url":"https://api.github.com/users/carmelre/repos","events_url":"https://api.github.com/users/carmelre/events{/privacy}","received_events_url":"https://api.github.com/users/carmelre/received_events","type":"User","site_admin":false},"repo":{"id":123942220,"name":"python_training","full_name":"carmelre/python_training","owner":{"login":"carmelre","id":33458504,"avatar_url":"https://avatars2.githubusercontent.com/u/33458504?v=4","gravatar_id":"","url":"https://api.github.com/users/carmelre","html_url":"https://github.com/carmelre","followers_url":"https://api.github.com/users/carmelre/followers","following_url":"https://api.github.com/users/carmelre/following{/other_user}","gists_url":"https://api.github.com/users/carmelre/gists{/gist_id}","starred_url":"https://api.github.com/users/carmelre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carmelre/subscriptions","organizations_url":"https://api.github.com/users/carmelre/orgs","repos_url":"https://api.github.com/users/carmelre/repos","events_url":"https://api.github.com/users/carmelre/events{/privacy}","received_events_url":"https://api.github.com/users/carmelre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carmelre/python_training","description":"Exercises:)","fork":false,"url":"https://api.github.com/repos/carmelre/python_training","forks_url":"https://api.github.com/repos/carmelre/python_training/forks","keys_url":"https://api.github.com/repos/carmelre/python_training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carmelre/python_training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carmelre/python_training/teams","hooks_url":"https://api.github.com/repos/carmelre/python_training/hooks","issue_events_url":"https://api.github.com/repos/carmelre/python_training/issues/events{/number}","events_url":"https://api.github.com/repos/carmelre/python_training/events","assignees_url":"https://api.github.com/repos/carmelre/python_training/assignees{/user}","branches_url":"https://api.github.com/repos/carmelre/python_training/branches{/branch}","tags_url":"https://api.github.com/repos/carmelre/python_training/tags","blobs_url":"https://api.github.com/repos/carmelre/python_training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carmelre/python_training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carmelre/python_training/git/refs{/sha}","trees_url":"https://api.github.com/repos/carmelre/python_training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carmelre/python_training/statuses/{sha}","languages_url":"https://api.github.com/repos/carmelre/python_training/languages","stargazers_url":"https://api.github.com/repos/carmelre/python_training/stargazers","contributors_url":"https://api.github.com/repos/carmelre/python_training/contributors","subscribers_url":"https://api.github.com/repos/carmelre/python_training/subscribers","subscription_url":"https://api.github.com/repos/carmelre/python_training/subscription","commits_url":"https://api.github.com/repos/carmelre/python_training/commits{/sha}","git_commits_url":"https://api.github.com/repos/carmelre/python_training/git/commits{/sha}","comments_url":"https://api.github.com/repos/carmelre/python_training/comments{/number}","issue_comment_url":"https://api.github.com/repos/carmelre/python_training/issues/comments{/number}","contents_url":"https://api.github.com/repos/carmelre/python_training/contents/{+path}","compare_url":"https://api.github.com/repos/carmelre/python_training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carmelre/python_training/merges","archive_url":"https://api.github.com/repos/carmelre/python_training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carmelre/python_training/downloads","issues_url":"https://api.github.com/repos/carmelre/python_training/issues{/number}","pulls_url":"https://api.github.com/repos/carmelre/python_training/pulls{/number}","milestones_url":"https://api.github.com/repos/carmelre/python_training/milestones{/number}","notifications_url":"https://api.github.com/repos/carmelre/python_training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carmelre/python_training/labels{/name}","releases_url":"https://api.github.com/repos/carmelre/python_training/releases{/id}","deployments_url":"https://api.github.com/repos/carmelre/python_training/deployments","created_at":"2018-03-05T15:50:01Z","updated_at":"2018-03-07T13:55:02Z","pushed_at":"2018-04-26T12:22:58Z","git_url":"git://github.com/carmelre/python_training.git","ssh_url":"git@github.com:carmelre/python_training.git","clone_url":"https://github.com/carmelre/python_training.git","svn_url":"https://github.com/carmelre/python_training","homepage":null,"size":68,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/12"},"html":{"href":"https://github.com/carmelre/python_training/pull/12"},"issue":{"href":"https://api.github.com/repos/carmelre/python_training/issues/12"},"comments":{"href":"https://api.github.com/repos/carmelre/python_training/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/carmelre/python_training/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/carmelre/python_training/statuses/bdbb62e47415d8b32d8124e534d96e3f980ea263"}},"author_association":"OWNER"}}
{"actor":{"display_login":"AlonSh"}}