GitHub PullRequestReviewCommentEvent at 2014-12-15 13:03:47
Repository: Microsoft-Translator-Python-API
Actor: sharoonthomas
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/comments/21821902","id":21821902,"diff_hunk":"@@ -142,6 +144,46 @@ def call(self, url, params):\n             return self.call(url, params)\n         return rv\n \n+    def get_languages(self):\n+        \"\"\"Fetches the languages supported by Microsoft Translator\n+           Returns list of languages\n+        \"\"\"\n+        if not self.access_token:\n+            self.access_token = self.get_access_token()\n+\n+        url = 'http://api.microsofttranslator.com/V2/Http.svc' +\n+        '/GetLanguagesForTranslate'\n+        response = requests.get(url,\n+            headers={'Authorization': 'Bearer %s' % self.access_token})\n+        response.encoding = 'UTF-8-sig'\n+\n+        languages = []\n+        xml = minidom.parseString(response.text)\n+        array = xml.firstChild\n+        for childNode in array.childNodes:\n+            languages.append(childNode.firstChild.nodeValue)\n+\n+        [language.decode('UTF-8') for language in languages]\n+\n+        return languages\n+\n+    def detect_language(self, text):\n+        \"\"\"Detects language of given string\n+           Returns two letter language - Example : fr\n+        \"\"\"\n+        if not self.access_token:","path":"__init__.py","position":40,"original_position":40,"commit_id":"293e7dae82d1f853ada5e9b3231ec915cc778c3c","original_commit_id":"293e7dae82d1f853ada5e9b3231ec915cc778c3c","user":{"login":"sharoonthomas","id":305807,"avatar_url":"https://avatars.githubusercontent.com/u/305807?v=3","gravatar_id":"","url":"https://api.github.com/users/sharoonthomas","html_url":"https://github.com/sharoonthomas","followers_url":"https://api.github.com/users/sharoonthomas/followers","following_url":"https://api.github.com/users/sharoonthomas/following{/other_user}","gists_url":"https://api.github.com/users/sharoonthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/sharoonthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharoonthomas/subscriptions","organizations_url":"https://api.github.com/users/sharoonthomas/orgs","repos_url":"https://api.github.com/users/sharoonthomas/repos","events_url":"https://api.github.com/users/sharoonthomas/events{/privacy}","received_events_url":"https://api.github.com/users/sharoonthomas/received_events","type":"User","site_admin":false},"body":"Can it be because you are calling http [1] endpoints while the other APIs are using the AJAX [2] endpoints of the web service ?\r\n \r\n[1] http://msdn.microsoft.com/en-us/library/ff512387.aspx\r\n[2] http://msdn.microsoft.com/en-us/library/ff512385.aspx","created_at":"2014-12-15T13:03:47Z","updated_at":"2014-12-15T13:03:47Z","html_url":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16#discussion_r21821902","pull_request_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/comments/21821902"},"html":{"href":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16#discussion_r21821902"},"pull_request":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16","id":26065060,"html_url":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16","diff_url":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16.diff","patch_url":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16.patch","issue_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/16","number":16,"state":"open","locked":false,"title":"Added get_languages(), detect_language() functions and test cases for th...","user":{"login":"torcellite","id":3049807,"avatar_url":"https://avatars.githubusercontent.com/u/3049807?v=3","gravatar_id":"","url":"https://api.github.com/users/torcellite","html_url":"https://github.com/torcellite","followers_url":"https://api.github.com/users/torcellite/followers","following_url":"https://api.github.com/users/torcellite/following{/other_user}","gists_url":"https://api.github.com/users/torcellite/gists{/gist_id}","starred_url":"https://api.github.com/users/torcellite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torcellite/subscriptions","organizations_url":"https://api.github.com/users/torcellite/orgs","repos_url":"https://api.github.com/users/torcellite/repos","events_url":"https://api.github.com/users/torcellite/events{/privacy}","received_events_url":"https://api.github.com/users/torcellite/received_events","type":"User","site_admin":false},"body":"*Added the get_languages() function to get a Python list of the supported language locale codes.\r\n*Added detect_language() function to detect the language of the input text.\r\n*Added test cases for both functions - Test cases pass with no failures.","created_at":"2014-12-15T12:15:31Z","updated_at":"2014-12-15T13:03:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b57ebc13bbe79d9bac93fa7e4d3905effe02c17","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16/commits","review_comments_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16/comments","review_comment_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/16/comments","statuses_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/statuses/293e7dae82d1f853ada5e9b3231ec915cc778c3c","head":{"label":"torcellite:master","ref":"master","sha":"293e7dae82d1f853ada5e9b3231ec915cc778c3c","user":{"login":"torcellite","id":3049807,"avatar_url":"https://avatars.githubusercontent.com/u/3049807?v=3","gravatar_id":"","url":"https://api.github.com/users/torcellite","html_url":"https://github.com/torcellite","followers_url":"https://api.github.com/users/torcellite/followers","following_url":"https://api.github.com/users/torcellite/following{/other_user}","gists_url":"https://api.github.com/users/torcellite/gists{/gist_id}","starred_url":"https://api.github.com/users/torcellite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torcellite/subscriptions","organizations_url":"https://api.github.com/users/torcellite/orgs","repos_url":"https://api.github.com/users/torcellite/repos","events_url":"https://api.github.com/users/torcellite/events{/privacy}","received_events_url":"https://api.github.com/users/torcellite/received_events","type":"User","site_admin":false},"repo":{"id":28033952,"name":"Microsoft-Translator-Python-API","full_name":"torcellite/Microsoft-Translator-Python-API","owner":{"login":"torcellite","id":3049807,"avatar_url":"https://avatars.githubusercontent.com/u/3049807?v=3","gravatar_id":"","url":"https://api.github.com/users/torcellite","html_url":"https://github.com/torcellite","followers_url":"https://api.github.com/users/torcellite/followers","following_url":"https://api.github.com/users/torcellite/following{/other_user}","gists_url":"https://api.github.com/users/torcellite/gists{/gist_id}","starred_url":"https://api.github.com/users/torcellite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torcellite/subscriptions","organizations_url":"https://api.github.com/users/torcellite/orgs","repos_url":"https://api.github.com/users/torcellite/repos","events_url":"https://api.github.com/users/torcellite/events{/privacy}","received_events_url":"https://api.github.com/users/torcellite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/torcellite/Microsoft-Translator-Python-API","description":"The Microsoft Translator services can be used in web or client applications to perform language translation operations.","fork":true,"url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API","forks_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/forks","keys_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/teams","hooks_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/hooks","issue_events_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/issues/events{/number}","events_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/events","assignees_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/assignees{/user}","branches_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/branches{/branch}","tags_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/tags","blobs_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/statuses/{sha}","languages_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/languages","stargazers_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/stargazers","contributors_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/contributors","subscribers_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/subscribers","subscription_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/subscription","commits_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/issues/comments/{number}","contents_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/contents/{+path}","compare_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/merges","archive_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/downloads","issues_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/issues{/number}","pulls_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/pulls{/number}","milestones_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/milestones{/number}","notifications_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/labels{/name}","releases_url":"https://api.github.com/repos/torcellite/Microsoft-Translator-Python-API/releases{/id}","created_at":"2014-12-15T11:35:09Z","updated_at":"2014-12-15T12:40:38Z","pushed_at":"2014-12-15T12:40:38Z","git_url":"git://github.com/torcellite/Microsoft-Translator-Python-API.git","ssh_url":"git@github.com:torcellite/Microsoft-Translator-Python-API.git","clone_url":"https://github.com/torcellite/Microsoft-Translator-Python-API.git","svn_url":"https://github.com/torcellite/Microsoft-Translator-Python-API","homepage":"","size":108,"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":"openlabs:master","ref":"master","sha":"493405a073d0049aaac295521e359c7cac7e84fa","user":{"login":"openlabs","id":777983,"avatar_url":"https://avatars.githubusercontent.com/u/777983?v=3","gravatar_id":"","url":"https://api.github.com/users/openlabs","html_url":"https://github.com/openlabs","followers_url":"https://api.github.com/users/openlabs/followers","following_url":"https://api.github.com/users/openlabs/following{/other_user}","gists_url":"https://api.github.com/users/openlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/openlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlabs/subscriptions","organizations_url":"https://api.github.com/users/openlabs/orgs","repos_url":"https://api.github.com/users/openlabs/repos","events_url":"https://api.github.com/users/openlabs/events{/privacy}","received_events_url":"https://api.github.com/users/openlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":1725375,"name":"Microsoft-Translator-Python-API","full_name":"openlabs/Microsoft-Translator-Python-API","owner":{"login":"openlabs","id":777983,"avatar_url":"https://avatars.githubusercontent.com/u/777983?v=3","gravatar_id":"","url":"https://api.github.com/users/openlabs","html_url":"https://github.com/openlabs","followers_url":"https://api.github.com/users/openlabs/followers","following_url":"https://api.github.com/users/openlabs/following{/other_user}","gists_url":"https://api.github.com/users/openlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/openlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlabs/subscriptions","organizations_url":"https://api.github.com/users/openlabs/orgs","repos_url":"https://api.github.com/users/openlabs/repos","events_url":"https://api.github.com/users/openlabs/events{/privacy}","received_events_url":"https://api.github.com/users/openlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openlabs/Microsoft-Translator-Python-API","description":"The Microsoft Translator services can be used in web or client applications to perform language translation operations.","fork":false,"url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API","forks_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/forks","keys_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/teams","hooks_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/hooks","issue_events_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/events{/number}","events_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/events","assignees_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/assignees{/user}","branches_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/branches{/branch}","tags_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/tags","blobs_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/git/refs{/sha}","trees_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/statuses/{sha}","languages_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/languages","stargazers_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/stargazers","contributors_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/contributors","subscribers_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/subscribers","subscription_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/subscription","commits_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/commits{/sha}","git_commits_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/git/commits{/sha}","comments_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/comments{/number}","issue_comment_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/comments/{number}","contents_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/contents/{+path}","compare_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/merges","archive_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/downloads","issues_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues{/number}","pulls_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls{/number}","milestones_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/milestones{/number}","notifications_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/labels{/name}","releases_url":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/releases{/id}","created_at":"2011-05-09T23:40:10Z","updated_at":"2014-12-15T12:16:32Z","pushed_at":"2014-07-07T08:28:03Z","git_url":"git://github.com/openlabs/Microsoft-Translator-Python-API.git","ssh_url":"git@github.com:openlabs/Microsoft-Translator-Python-API.git","clone_url":"https://github.com/openlabs/Microsoft-Translator-Python-API.git","svn_url":"https://github.com/openlabs/Microsoft-Translator-Python-API","homepage":"","size":324,"stargazers_count":37,"watchers_count":37,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":7,"forks":24,"open_issues":7,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16"},"html":{"href":"https://github.com/openlabs/Microsoft-Translator-Python-API/pull/16"},"issue":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/16"},"comments":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/openlabs/Microsoft-Translator-Python-API/statuses/293e7dae82d1f853ada5e9b3231ec915cc778c3c"}}}}