Skip to content

A Google API based client based on two APIs: GEO CODING AND PLACES API which can used installed in your Google platform project.

Notifications You must be signed in to change notification settings

chaudharypraveen98/GoogleApiClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Google Map Api Client

This is Api client is made by me for simple and quick integration. It will find places in a location such as parks, malls, hotels and much more. This provides methods to find the places based on place id and search places with with their some names.

How to setup the Api Client :-

  1. Make a project on Google Cloud Platfrom. Be sure to enable billing feature. It won't cost you untill you make thousand of requests. Then enable GEOCODING API and PLACES API in your project section.
  2. First run the requirements.txt to install the dependencies by the below code:-
    python3 install -r requirements.txt
  3. Enter your own api key in GOOGLE_API_KEY in python code.
  4. That's all, Hurray.

How to use the Api:

  1. First make a object of the api class. Give a default address. You can add the For example :-
    client = GoogleMapsClient(api_key=GOOGLE_API_KEY,default_address="Enter_the_desired_location")
  2. This Api provides two method:
    - 2.1 Search places in a location
    - 2.2 Find a place using the Place ID.
  3. Using the Search places. Basic syntax :-
    client.search(keyword="ANYTHING",location="ANY",radius="")
    It has three parameters:

    -keyword:It can be anything that you want to search like mall, hotel , restaurant, park and much more.
    -location: It can be anywhere. It is optional as it will search places in default_address.
    -radius: It is the radius of area to search. It is in meters and the default value is set as 1000. You can change it by giving value in parameter.

    sample example:-
    client.search(keyword="mall",location="faridabad",radius=3000)
  4. Using the Place method. Basic syntax :-
    client.detail(self, place_id="ENTER_THE_PLACE_ID", fields=[ENTER THE FIELD YOU WANT TO FIND])
    Currently the google provide four fields:- "name", "rating", "formatted_phone_number". You can use anyone. Dont pass the field parameter if you want all the parameters as it is already intialized in the code
    sample example for all field:-
    client.detail(place_id="ChIJqW9BqQe6j4AR0il4CC315_s")
    sample example for particular field:-
    client.detail(place_id="ChIJqW9BqQe6j4AR0il4CC315_s", fields=["name"])

Note :- This Api will give the json response.

It uses the two Api to fetch the data and process it.
You can use this code anywhere without any permission

About

A Google API based client based on two APIs: GEO CODING AND PLACES API which can used installed in your Google platform project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages