{"action":"created","comment":{"url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/comments/34000958","id":34000958,"diff_hunk":"@@ -0,0 +1,29 @@\n+import unittest\n+from six import text_type, u, b, PY2, PY3\n+from six.moves.urllib.parse import parse_qs\n+from nose.tools import raises\n+from sure import expect\n+import httpretty\n+\n+from opentok import OpenTok, Session, MediaModes, OpenTokException, __version__\n+\n+class OpenTokSessionCreationTest(unittest.TestCase):\n+    def setUp(self):\n+        self.api_key = u('123456')\n+        self.api_secret = u('1234567890abcdef1234567890abcdef1234567890')\n+        httpretty.enable()\n+        httpretty.register_uri(httpretty.POST, u('https://api.opentok.com/session/create'),\n+                               body=u('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon Mar 17 00:41:31 PDT 2014</create_dt></Session></sessions>'),\n+                               status=200,\n+                               content_type=u('text/xml'))\n+\n+    def tearDown(self):\n+        httpretty.disable()\n+\n+    def test_timeout(self):\n+        # TODO: tell httpretty to timeout\n+        opentok = OpenTok(self.api_key, self.api_secret, timeout=5)\n+\n+        session = opentok.create_session()\n+","path":"tests/test_http_options.py","position":28,"original_position":28,"commit_id":"c89d73175df15d3a6cfefb12c6997c3ba32ecd24","original_commit_id":"c89d73175df15d3a6cfefb12c6997c3ba32ecd24","user":{"login":"coulix","id":26057,"avatar_url":"https://avatars.githubusercontent.com/u/26057?v=3","gravatar_id":"","url":"https://api.github.com/users/coulix","html_url":"https://github.com/coulix","followers_url":"https://api.github.com/users/coulix/followers","following_url":"https://api.github.com/users/coulix/following{/other_user}","gists_url":"https://api.github.com/users/coulix/gists{/gist_id}","starred_url":"https://api.github.com/users/coulix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coulix/subscriptions","organizations_url":"https://api.github.com/users/coulix/orgs","repos_url":"https://api.github.com/users/coulix/repos","events_url":"https://api.github.com/users/coulix/events{/privacy}","received_events_url":"https://api.github.com/users/coulix/received_events","type":"User","site_admin":false},"body":"To test the exception we could do something like this.\r\n\r\n    # create a callback body that raises an exception when opened\r\n    def exceptionCallback(request, uri, headers):\r\n\r\n        # raise your favourite exception here, e.g. requests.ConnectionError or requests.Timeout\r\n        raise requests.Timeout('Connection timed out.')\r\n\r\n    # set up a mock and use the callback function as response's body\r\n    httpretty.register_uri(\r\n            method=httpretty.GET,\r\n            uri='https://api.opentok.com/session/create',\r\n            status=200,\r\n            body=exceptionCallback\r\n        )\r\n\r\n    with self.assertRaises(requests.Timeout):\r\n        opentok = OpenTok(self.api_key, self.api_secret, timeout=5\r\n        session = opentok.create_session()","created_at":"2015-07-07T01:26:58Z","updated_at":"2015-07-07T01:26:58Z","html_url":"https://github.com/opentok/Opentok-Python-SDK/pull/57#discussion_r34000958","pull_request_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/comments/34000958"},"html":{"href":"https://github.com/opentok/Opentok-Python-SDK/pull/57#discussion_r34000958"},"pull_request":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57","id":30391895,"html_url":"https://github.com/opentok/Opentok-Python-SDK/pull/57","diff_url":"https://github.com/opentok/Opentok-Python-SDK/pull/57.diff","patch_url":"https://github.com/opentok/Opentok-Python-SDK/pull/57.patch","issue_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/57","number":57,"state":"open","locked":false,"title":"WIP add timeout option","user":{"login":"aoberoi","id":494795,"avatar_url":"https://avatars.githubusercontent.com/u/494795?v=3","gravatar_id":"","url":"https://api.github.com/users/aoberoi","html_url":"https://github.com/aoberoi","followers_url":"https://api.github.com/users/aoberoi/followers","following_url":"https://api.github.com/users/aoberoi/following{/other_user}","gists_url":"https://api.github.com/users/aoberoi/gists{/gist_id}","starred_url":"https://api.github.com/users/aoberoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoberoi/subscriptions","organizations_url":"https://api.github.com/users/aoberoi/orgs","repos_url":"https://api.github.com/users/aoberoi/repos","events_url":"https://api.github.com/users/aoberoi/events{/privacy}","received_events_url":"https://api.github.com/users/aoberoi/received_events","type":"User","site_admin":false},"body":"starts to address #56. the implementation probably works, but the testing is blocked on gabrielfalcao/HTTPretty#202","created_at":"2015-03-03T17:01:50Z","updated_at":"2015-07-07T01:26:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c6481d5691d3df381a22ac8213268da8a6098c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57/commits","review_comments_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57/comments","review_comment_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/57/comments","statuses_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/statuses/c89d73175df15d3a6cfefb12c6997c3ba32ecd24","head":{"label":"aoberoi:f.default-timeout","ref":"f.default-timeout","sha":"c89d73175df15d3a6cfefb12c6997c3ba32ecd24","user":{"login":"aoberoi","id":494795,"avatar_url":"https://avatars.githubusercontent.com/u/494795?v=3","gravatar_id":"","url":"https://api.github.com/users/aoberoi","html_url":"https://github.com/aoberoi","followers_url":"https://api.github.com/users/aoberoi/followers","following_url":"https://api.github.com/users/aoberoi/following{/other_user}","gists_url":"https://api.github.com/users/aoberoi/gists{/gist_id}","starred_url":"https://api.github.com/users/aoberoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoberoi/subscriptions","organizations_url":"https://api.github.com/users/aoberoi/orgs","repos_url":"https://api.github.com/users/aoberoi/repos","events_url":"https://api.github.com/users/aoberoi/events{/privacy}","received_events_url":"https://api.github.com/users/aoberoi/received_events","type":"User","site_admin":false},"repo":{"id":17999723,"name":"Opentok-Python-SDK","full_name":"aoberoi/Opentok-Python-SDK","owner":{"login":"aoberoi","id":494795,"avatar_url":"https://avatars.githubusercontent.com/u/494795?v=3","gravatar_id":"","url":"https://api.github.com/users/aoberoi","html_url":"https://github.com/aoberoi","followers_url":"https://api.github.com/users/aoberoi/followers","following_url":"https://api.github.com/users/aoberoi/following{/other_user}","gists_url":"https://api.github.com/users/aoberoi/gists{/gist_id}","starred_url":"https://api.github.com/users/aoberoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoberoi/subscriptions","organizations_url":"https://api.github.com/users/aoberoi/orgs","repos_url":"https://api.github.com/users/aoberoi/repos","events_url":"https://api.github.com/users/aoberoi/events{/privacy}","received_events_url":"https://api.github.com/users/aoberoi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aoberoi/Opentok-Python-SDK","description":"","fork":true,"url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK","forks_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/forks","keys_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/teams","hooks_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/hooks","issue_events_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/issues/events{/number}","events_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/events","assignees_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/assignees{/user}","branches_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/branches{/branch}","tags_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/tags","blobs_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/statuses/{sha}","languages_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/languages","stargazers_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/stargazers","contributors_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/contributors","subscribers_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/subscribers","subscription_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/subscription","commits_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/contents/{+path}","compare_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/merges","archive_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/downloads","issues_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/issues{/number}","pulls_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/pulls{/number}","milestones_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/milestones{/number}","notifications_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/labels{/name}","releases_url":"https://api.github.com/repos/aoberoi/Opentok-Python-SDK/releases{/id}","created_at":"2014-03-22T01:52:48Z","updated_at":"2014-06-20T15:39:51Z","pushed_at":"2015-05-21T15:12:08Z","git_url":"git://github.com/aoberoi/Opentok-Python-SDK.git","ssh_url":"git@github.com:aoberoi/Opentok-Python-SDK.git","clone_url":"https://github.com/aoberoi/Opentok-Python-SDK.git","svn_url":"https://github.com/aoberoi/Opentok-Python-SDK","homepage":"","size":596,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"opentok:master","ref":"master","sha":"f4b39aa9084ef294b1d062ddeb5d3725334148a8","user":{"login":"opentok","id":759567,"avatar_url":"https://avatars.githubusercontent.com/u/759567?v=3","gravatar_id":"","url":"https://api.github.com/users/opentok","html_url":"https://github.com/opentok","followers_url":"https://api.github.com/users/opentok/followers","following_url":"https://api.github.com/users/opentok/following{/other_user}","gists_url":"https://api.github.com/users/opentok/gists{/gist_id}","starred_url":"https://api.github.com/users/opentok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentok/subscriptions","organizations_url":"https://api.github.com/users/opentok/orgs","repos_url":"https://api.github.com/users/opentok/repos","events_url":"https://api.github.com/users/opentok/events{/privacy}","received_events_url":"https://api.github.com/users/opentok/received_events","type":"Organization","site_admin":false},"repo":{"id":2571725,"name":"Opentok-Python-SDK","full_name":"opentok/Opentok-Python-SDK","owner":{"login":"opentok","id":759567,"avatar_url":"https://avatars.githubusercontent.com/u/759567?v=3","gravatar_id":"","url":"https://api.github.com/users/opentok","html_url":"https://github.com/opentok","followers_url":"https://api.github.com/users/opentok/followers","following_url":"https://api.github.com/users/opentok/following{/other_user}","gists_url":"https://api.github.com/users/opentok/gists{/gist_id}","starred_url":"https://api.github.com/users/opentok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentok/subscriptions","organizations_url":"https://api.github.com/users/opentok/orgs","repos_url":"https://api.github.com/users/opentok/repos","events_url":"https://api.github.com/users/opentok/events{/privacy}","received_events_url":"https://api.github.com/users/opentok/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentok/Opentok-Python-SDK","description":"","fork":false,"url":"https://api.github.com/repos/opentok/Opentok-Python-SDK","forks_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/forks","keys_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/teams","hooks_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/hooks","issue_events_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/events{/number}","events_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/events","assignees_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/assignees{/user}","branches_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/branches{/branch}","tags_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/tags","blobs_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/statuses/{sha}","languages_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/languages","stargazers_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/stargazers","contributors_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/contributors","subscribers_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/subscribers","subscription_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/subscription","commits_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/contents/{+path}","compare_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/merges","archive_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/downloads","issues_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues{/number}","pulls_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls{/number}","milestones_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/milestones{/number}","notifications_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/labels{/name}","releases_url":"https://api.github.com/repos/opentok/Opentok-Python-SDK/releases{/id}","created_at":"2011-10-13T19:14:51Z","updated_at":"2015-03-30T19:51:45Z","pushed_at":"2015-06-17T02:09:16Z","git_url":"git://github.com/opentok/Opentok-Python-SDK.git","ssh_url":"git@github.com:opentok/Opentok-Python-SDK.git","clone_url":"https://github.com/opentok/Opentok-Python-SDK.git","svn_url":"https://github.com/opentok/Opentok-Python-SDK","homepage":"","size":746,"stargazers_count":39,"watchers_count":39,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":14,"forks":27,"open_issues":14,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57"},"html":{"href":"https://github.com/opentok/Opentok-Python-SDK/pull/57"},"issue":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/57"},"comments":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/opentok/Opentok-Python-SDK/statuses/c89d73175df15d3a6cfefb12c6997c3ba32ecd24"}}}}