This repository contains the open source code for an API that fetches the URL of image from Google Place Photos efficiently to minimize your API usage.
- Valid Google API Key
- placeId and photoref of the place that you want image for
- SQL Database server URL
Once you have the specified items ready, we are good to go.
- Clone this repository
- Create a Python3 virtual environment and activate it.
- Install requirements
pip install -r requirements.txt
- Set environment variables
-
set API_KEY=<YOUR_API_KEY>
set DATABASE_URL=<YOUR_DATABASE_URL>
-
export API_KEY=<YOUR_API_KEY>
export DATABASE_URL=<YOUR_DATABASE_URL>
-
The following command will fire up an application server:
uvicorn app.main:app
-
/images/custom
-
GET
-
-
placeid=[string]
PlaceId of the place that the photo corresponds tophotoref=[string]
Photo Reference of the photo you want to fetch
-
city=[string]
City where the place resides
-
{
"status": "SUCCESS",
"response": {
"action_taken": "FOUND",
"placeid": string,
"photoref": string,
"image_url": string,
"n_requests": integer,
"city": string
}
}
{
"status": "FAILURE",
"response": {
"message" : ERROR_MESSAGE
}
}
-
curl -XGET 'root_url/images/custom?placeid=<PLACEID>&photoref=<PHOTOREF>&city=<CITY>'
This project is mantained by:
Quick Pic is MIT licensed.