Baato API for Python
Project description
Baato Python Library
The Python library makes it easy to consume the Baato API into existing python projects.
baato-python has been tested with:
- Python: 3.6, 3.7, 3.8, 3.9, 3.10
Installation
Baato Python can be installed from PyPI with tools like pip
:
$ pip install baato
Features
The Baato Python client library makes it easy to integrate the Baato API into existing python projects. This package acts as a wrapper for the following Baato services:
Usage
Search API
After initializing Baato with your access token, the search()
method can be used to make requests to the Search API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
"""Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.search(q="kathmandu")
print(response["data"])
print(response["status"])
"""Optional Search Parameters
- lat and lon =>(float) latitude and longitude coordinates. Useful in mobile applications for providing geographical context to the search.
- type =>(str) The type or category of results that the request should return. For example: hospital, cafe etc.
- radius =>(int) Radius, in kilometers from the specified lat/lon pair within which to look for results. Only integer values supported. By default the value is set to 10.
- limit =>(int) The number of results that the request should return. By default the value is set to 5.
"""
Reverse Search API
After initializing Baato with your access token, the reverse()
method can be used to make requests to the Reverse Search API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
""" Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.reverse(lat=27.70446921370009,lon=85.32051086425783)
print(response["data"])
print(response["status"])
"""Optional Reverse Parameters
- radius =>(int) A proxy variable for the inaccuracy, denoting how close around the coordinates should the algorithm look for potential address nodes.
- limit =>(int) The number of results to be returned; defaults to 1.
"""
Places API
After initializing Baato with your access token, the places()
method can be used to make requests to the Places API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
""" Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.places(place_id=100006)
print(response["data"])
print(response["status"])
NearbyPlaces API
After initializing Baato with your access token, the near_by()
method can be used to make requests to the NearbyPlaces API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
""" Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.near_by(lat=27.717245, lon=85.323959, type="school")
print(response["data"])
print(response["status"])
"""Here is the list for merged feature types:
- eat => Returns results for cafe, restaurant, bakery
- grocery => Returns results for department_store, supermarket
- tourism => Returns results for attraction, artwork, museum,park
- transport => Returns results for bus_stop, bus_station
- parking => Returns results for parking, bicycle_parking, underground,multi-storey, parking_space, car_parking
- shopping => Returns results for jewelry, sports, gift ,mall,department_store,hardware,kitchen, furniture
- children => Returns results for swimming_pool, playground, recreation_ground, park, water_park, disneyland
- night_life => Returns results for pub, bar, nightclub
- entertainment => Returns results for cinema, theatre, casino, nightclub
- clinic => Returns results for clinic, dentist, veterinary, herbalist, ayurvedic
- workshop => Returns results for metal, bicycle, aluminium, car_repair, tyres, car_parts
"""
"""Optional Near By Parameters
- radius =>(int) Radius, in kilometers from the specified lat/lon pair within which to look for results. Only integer values supported. By default the value is set to 10.
- limit =>(int) The number of results that the request should return. By default the value is set to 5.
"""
Directions API
After initializing Baato with your access token, the direction()
method can be used to make requests to the Directions API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
""" Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.direction(points=["27.71772,85.32784", "27.73449,85.33714"], mode="car")
print(response["data"])
print(response["status"])
"""Here is the availabe mode:
- car
- bike
- foot
"""
"""Optional Near By Parameters
- alternatives =>(boolen) enable alternatives by setting alternatives=true.
- instructions =>(boolen) enable instructions by setting instructions=true.
Map Styles API
After initializing Baato with your access token, the map_style()
method can be used to make requests to the Map Styles API.
from baato import BaatoClient
client = BaatoClient(access_token="YOUR_ACCESS_KEY")
""" Optional Initilization Parameters
- endpoint="https://api.baato.io/api" # default
- version="v1" # default
"""
response = client.map_style(style_name="monochrome")
print(response["data"])
print(response["status"])
"""Here is the availabe style_name:
- monochrome
- breeze
- dark
- black_white
- roads
- retro
"""
Contributing
Development Environment
Fork the repository
Once you have forked this repository to your own GitHub account, install your own fork in your development environment:
$ git clone git@github.com:<your_fork>/python-client.git
$ cd python-client
$ pip install -r requirements.txt
Running the tests
Test all supported versions You can also use the excellent tox testing tool to run the tests against all supported versions of Python. Install tox, and then simply run:
$ pip install tox
In the tox.ini file update your YOUR_BAATO_ACCESS_TOKEN
then.
$ tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file baato-1.0.1.tar.gz
.
File metadata
- Download URL: baato-1.0.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 263d6bd10795b9e4091a414c16b04c615b7a9dbf212db405f7f5f87a2b9b5d64 |
|
MD5 | c53afa6a9f2b4863de24a87dc11ecd80 |
|
BLAKE2b-256 | a72e6b8c3f723bce6f8e75587a579192377c0ff6610a9388db90b81809086059 |
File details
Details for the file baato-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: baato-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3960da626d63f7f5b271eec3063f3d81ccd3a0ecb8770194322c6e2189c6577f |
|
MD5 | 2a4a6c407f9ebdcc31a9da50d824f132 |
|
BLAKE2b-256 | f242b113f89e1fd5c89570bdc75518807ab471103bc9c7e1b2bdf194a3dcac4c |