Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crab85193 committed Dec 18, 2023
1 parent faabb66 commit 02b00c5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/google_api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def download_place_photo(self, photo_reference, file_name=None):

if response.status_code == 200:
if file_name:
f_name = os.environ.get("SAVE_IMG_DIR") + "/" + file_name
f_name = os.environ.get("SAVE_IMG_DIR") + "/" + file_name + ".jpg"
else:
f_name = os.environ.get("SAVE_IMG_DIR") + "/" + photo_reference + ".jpg"

Expand All @@ -31,9 +31,9 @@ def download_place_photo(self, photo_reference, file_name=None):
else:
print("Error: Unable to download the image.")

def get_store_photo_url(self, photo_reference):
self.download_place_photo(photo_reference)
return f"{os.environ.get('IMAGE_SERVER_PROTOCOL')}://{os.environ.get('IMAGE_SERVER_ADDRESS')}/static/{photo_reference}.jpg"
def get_store_photo_url(self, photo_reference, place_id):
self.download_place_photo(photo_reference, place_id)
return f"{os.environ.get('IMAGE_SERVER_PROTOCOL')}://{os.environ.get('IMAGE_SERVER_ADDRESS')}/static/{place_id}.jpg"

def search_store(self, keyword):
location = geocoder.ip('me').latlng
Expand All @@ -57,7 +57,7 @@ def search_store(self, keyword):
except Exception as e:
store_info["open"] = None
try:
store_info["photos"] = self.get_store_photo_url(place["photos"][0]["photo_reference"])
store_info["photos"] = self.get_store_photo_url(place["photos"][0]["photo_reference"], place["place_id"])
except Exception as e:
print(e)
store_info["photos"] = ""
Expand Down

0 comments on commit 02b00c5

Please sign in to comment.