{"action":"created","comment":{"url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/comments/41583094","id":41583094,"diff_hunk":"@@ -0,0 +1,203 @@\n+#\n+# Copyright 2015 Google Inc. All rights reserved.\n+#\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+# use this file except in compliance with the License. You may obtain a copy of\n+# the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations under\n+# the License.\n+#\n+\n+\"\"\"Performs requests to the Google Maps Places API.\"\"\"\n+\n+from googlemaps import convert\n+\n+\n+def places(client, query, location=None, radius=None, language=None,\n+           min_price=None, max_price=None, open_now=False, types=None,\n+           page_token=None):\n+    \"\"\"\n+    Performs text search for places.\n+\n+    :param query: The text string on which to search, for example: \"restaurant\".\n+    :type query: string\n+\n+    :param location: The latitude/longitude value for which you wish to obtain the\n+                     closest, human-readable address.\n+    :type location: string, dict, list, or tuple\n+\n+    :param radius: Distance in meters within which to bias results.\n+    :type radius: int\n+\n+    :param language: The language in which to return results.\n+    :type langauge: string\n+\n+    :param min_price: Restricts results to only those places with no less than\n+                      this price level. Valid values are in the range from 0\n+                      (most affordable) to 4 (most expensive).\n+    :type min_price: int\n+\n+    :param max_price: Restricts results to only those places with no greater\n+                      than this price level. Valid values are in the range\n+                      from 0 (most affordable) to 4 (most expensive).\n+    :type max_price: int\n+\n+    :param open_now: Return only those places that are open for business at\n+                     the time the query is sent.\n+    :type open_now: bool\n+\n+    :param types: Restricts the results to places matching at least one of the\n+                  specified types.\n+    :type types: string or list of strings\n+\n+    :param page_token: Token from a previous search that when provided will\n+                       returns the next page of results for the same search.\n+    :type page_token: string\n+\n+    :rtype: result dict with the following keys:\n+            status: status code\n+            results: list of places\n+            html_attributions: set of attributions which must be displayed\n+            next_page_token: token for retrieving the next page of results\n+\n+    \"\"\"\n+    params = {}\n+\n+    if query:\n+        params[\"query\"] = query\n+    if location:\n+        params[\"location\"] = convert.latlng(location)\n+    if radius:\n+        params[\"radius\"] = radius\n+    if language:\n+        params[\"language\"] = language\n+    if min_price:\n+        params[\"minprice\"] = min_price\n+    if max_price:\n+        params[\"maxprice\"] = max_price\n+    if open_now:\n+        params[\"opennow\"] = \"true\"\n+    if page_token:\n+        params[\"pagetoken\"] = page_token\n+\n+    return client._get(\"/maps/api/place/textsearch/json\", params)\n+\n+\n+def place(client, place_id, language=None):\n+    \"\"\"\n+    Comprehensive details for an individual place.\n+\n+    :param place_id: A textual identifier that uniquely identifies a place,\n+                     returned from a Places search.\n+    :type place_id: string\n+\n+    :param language: The language in which to return results.\n+    :type langauge: string\n+\n+    :rtype: result dict with the following keys:\n+            status: status code\n+            result: dict containing place details\n+            html_attributions: set of attributions which must be displayed\n+\n+    \"\"\"\n+    params = {\"placeid\": place_id}\n+    if language:\n+        params[\"language\"] = language\n+    return client._get(\"/maps/api/place/details/json\", params)\n+\n+\n+def photo(client, photo_reference, max_width=None, max_height=None):\n+    \"\"\"\n+    Downloads a photo from the Places API.\n+\n+    :param photo_reference: A string identifier that uniquely identifies a\n+      photo, as provided by either a Places search or Places detail request.\n+    :type photo_reference: string\n+\n+    :param max_width: Specifies the maximum desired width, in pixels.\n+    :type max_width: int\n+\n+    :param max_height: Specifies the maximum desired height, in pixels.\n+    :type max_height: int\n+\n+    :rtype: iterator containing the raw image data, which typically can be\n+      used to save an image file locally, eg:\n+\n+    ```\n+    f = open(local_filename, 'wb')\n+    for chunk in client.photo(photo_reference, max_width=100):\n+        if chunk:\n+            f.write(chunk)\n+    f.close()\n+    ```\n+\n+    \"\"\"\n+\n+    if not (max_width or max_height):\n+        raise ValueError(\"a max_width or max_height arg is required\")","path":"googlemaps/places.py","position":null,"original_position":144,"commit_id":"606fcbad96d3f41ea0db8557753999cf6aeda7e5","original_commit_id":"3d152eaca4c0f9e51e5bd39140f871b7cc3b3454","user":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"body":"It throws a 400 error without any meaningful message, and returns a default image (an icon that looks broken).\r\n\r\nI figure it's worth trapping if it at worst it saves a HTTP request and at best saves someone a broken app.\r\n\r\nWhat do you think?","created_at":"2015-10-08T23:30:04Z","updated_at":"2015-10-08T23:30:04Z","html_url":"https://github.com/googlemaps/google-maps-services-python/pull/95#discussion_r41583094","pull_request_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95","_links":{"self":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/comments/41583094"},"html":{"href":"https://github.com/googlemaps/google-maps-services-python/pull/95#discussion_r41583094"},"pull_request":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95","id":47107780,"html_url":"https://github.com/googlemaps/google-maps-services-python/pull/95","diff_url":"https://github.com/googlemaps/google-maps-services-python/pull/95.diff","patch_url":"https://github.com/googlemaps/google-maps-services-python/pull/95.patch","issue_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/95","number":95,"state":"open","locked":false,"title":"Added Places API.","user":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"body":"PTAL @domesticmouse @samthor @markmcd ","created_at":"2015-10-08T03:21:06Z","updated_at":"2015-10-08T23:30:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66ae22aedbd47313b5bef7ccd37b195a00f48c79","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95/commits","review_comments_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95/comments","review_comment_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/95/comments","statuses_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/statuses/606fcbad96d3f41ea0db8557753999cf6aeda7e5","head":{"label":"stephenmcd:places","ref":"places","sha":"606fcbad96d3f41ea0db8557753999cf6aeda7e5","user":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"repo":{"id":34355040,"name":"google-maps-services-python","full_name":"stephenmcd/google-maps-services-python","owner":{"login":"stephenmcd","id":116385,"avatar_url":"https://avatars.githubusercontent.com/u/116385?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmcd","html_url":"https://github.com/stephenmcd","followers_url":"https://api.github.com/users/stephenmcd/followers","following_url":"https://api.github.com/users/stephenmcd/following{/other_user}","gists_url":"https://api.github.com/users/stephenmcd/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmcd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmcd/subscriptions","organizations_url":"https://api.github.com/users/stephenmcd/orgs","repos_url":"https://api.github.com/users/stephenmcd/repos","events_url":"https://api.github.com/users/stephenmcd/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmcd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stephenmcd/google-maps-services-python","description":"Python client library for Google Maps API Web Services","fork":true,"url":"https://api.github.com/repos/stephenmcd/google-maps-services-python","forks_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/forks","keys_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/teams","hooks_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/hooks","issue_events_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/issues/events{/number}","events_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/events","assignees_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/assignees{/user}","branches_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/branches{/branch}","tags_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/tags","blobs_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/languages","stargazers_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/stargazers","contributors_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/contributors","subscribers_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/subscribers","subscription_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/subscription","commits_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/contents/{+path}","compare_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/merges","archive_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/downloads","issues_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/issues{/number}","pulls_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/labels{/name}","releases_url":"https://api.github.com/repos/stephenmcd/google-maps-services-python/releases{/id}","created_at":"2015-04-21T22:17:49Z","updated_at":"2015-04-30T00:59:13Z","pushed_at":"2015-10-08T23:21:11Z","git_url":"git://github.com/stephenmcd/google-maps-services-python.git","ssh_url":"git@github.com:stephenmcd/google-maps-services-python.git","clone_url":"https://github.com/stephenmcd/google-maps-services-python.git","svn_url":"https://github.com/stephenmcd/google-maps-services-python","homepage":"","size":517,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"googlemaps:master","ref":"master","sha":"ef3d6022681758a9f6cc3fd064eb202724d7dcab","user":{"login":"googlemaps","id":3717923,"avatar_url":"https://avatars.githubusercontent.com/u/3717923?v=3","gravatar_id":"","url":"https://api.github.com/users/googlemaps","html_url":"https://github.com/googlemaps","followers_url":"https://api.github.com/users/googlemaps/followers","following_url":"https://api.github.com/users/googlemaps/following{/other_user}","gists_url":"https://api.github.com/users/googlemaps/gists{/gist_id}","starred_url":"https://api.github.com/users/googlemaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlemaps/subscriptions","organizations_url":"https://api.github.com/users/googlemaps/orgs","repos_url":"https://api.github.com/users/googlemaps/repos","events_url":"https://api.github.com/users/googlemaps/events{/privacy}","received_events_url":"https://api.github.com/users/googlemaps/received_events","type":"Organization","site_admin":false},"repo":{"id":22978655,"name":"google-maps-services-python","full_name":"googlemaps/google-maps-services-python","owner":{"login":"googlemaps","id":3717923,"avatar_url":"https://avatars.githubusercontent.com/u/3717923?v=3","gravatar_id":"","url":"https://api.github.com/users/googlemaps","html_url":"https://github.com/googlemaps","followers_url":"https://api.github.com/users/googlemaps/followers","following_url":"https://api.github.com/users/googlemaps/following{/other_user}","gists_url":"https://api.github.com/users/googlemaps/gists{/gist_id}","starred_url":"https://api.github.com/users/googlemaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlemaps/subscriptions","organizations_url":"https://api.github.com/users/googlemaps/orgs","repos_url":"https://api.github.com/users/googlemaps/repos","events_url":"https://api.github.com/users/googlemaps/events{/privacy}","received_events_url":"https://api.github.com/users/googlemaps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlemaps/google-maps-services-python","description":"Python client library for Google Maps API Web Services","fork":false,"url":"https://api.github.com/repos/googlemaps/google-maps-services-python","forks_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/forks","keys_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/teams","hooks_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/hooks","issue_events_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/events{/number}","events_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/events","assignees_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/assignees{/user}","branches_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/branches{/branch}","tags_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/tags","blobs_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/statuses/{sha}","languages_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/languages","stargazers_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/stargazers","contributors_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/contributors","subscribers_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/subscribers","subscription_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/subscription","commits_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/contents/{+path}","compare_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/merges","archive_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/downloads","issues_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues{/number}","pulls_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls{/number}","milestones_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/milestones{/number}","notifications_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/labels{/name}","releases_url":"https://api.github.com/repos/googlemaps/google-maps-services-python/releases{/id}","created_at":"2014-08-15T04:35:30Z","updated_at":"2015-10-08T17:29:47Z","pushed_at":"2015-10-08T23:21:12Z","git_url":"git://github.com/googlemaps/google-maps-services-python.git","ssh_url":"git@github.com:googlemaps/google-maps-services-python.git","clone_url":"https://github.com/googlemaps/google-maps-services-python.git","svn_url":"https://github.com/googlemaps/google-maps-services-python","homepage":"","size":1074,"stargazers_count":243,"watchers_count":243,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":80,"mirror_url":null,"open_issues_count":9,"forks":80,"open_issues":9,"watchers":243,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95"},"html":{"href":"https://github.com/googlemaps/google-maps-services-python/pull/95"},"issue":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/95"},"comments":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/googlemaps/google-maps-services-python/statuses/606fcbad96d3f41ea0db8557753999cf6aeda7e5"}}}}