Skip to main content

Baato Python Library

Build License

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

Baato

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

Metadata

Release files for baato 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for baato 1.0.1
File Size Uploaded
baato-1.0.1.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for baato 1.0.1
File Interpreter ABI Platform
baato-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.0 kB

Release files / baato-1.0.1.tar.gz

Download URL baato-1.0.1.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
263d6bd10795b9e4091a414c16b04c615b7a9dbf212db405f7f5f87a2b9b5d64
BLAKE2b-256 checksum
How to use checksums
a72e6b8c3f723bce6f8e75587a579192377c0ff6610a9388db90b81809086059
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / baato-1.0.1-py2.py3-none-any.whl

Download URL baato-1.0.1-py2.py3-none-any.whl
Size 11.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3960da626d63f7f5b271eec3063f3d81ccd3a0ecb8770194322c6e2189c6577f
BLAKE2b-256 checksum
How to use checksums
f242b113f89e1fd5c89570bdc75518807ab471103bc9c7e1b2bdf194a3dcac4c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page