Skip to main content

OLA Maps Python Package

A Python wrapper for the OLA Maps API, providing easy-to-use abstractions for developers.

Stable Version Python Versions Download Stats

Supported APIs

  • Autocomplete
  • Geocoding
  • Reverse geocoding
  • Directions

Usage

Installation

Install the package using pip:

pip install olamaps

Authentication

There are two ways to authenticate:

  1. Using API key

    os.environ["OLAMAPS_API_KEY"] = "your_api_key"
    
    # OR
    client = Client(api_key="your_api_key")
    
  2. Or using client_id and client_secret

    os.environ["OLAMAPS_CLIENT_ID"] = "your_client_id"
    os.environ["OLAMAPS_CLIENT_SECRET"] = "your_client_secret"
    
    # OR
    client = Client(client_id="your_client_id", client_secret="your_client_secret")
    

Follow the same steps for AsyncClient as well.

Client

from olamaps import Client

# Initialize the client
client = Client()

# Autocomplete a query
results = client.autocomplete("Kempe")

# Geocode an address
results = client.geocode("MG Road, Bangalore")

# Reverse geocode a latitude-longitude pair
results = client.reverse_geocode(lat="12.9519408", lng="77.6381845")

# Get directions from one place to another
results = client.directions(
    origin="12.993103152916301,77.54332622119354",
    destination="12.972006793201695,77.5800850011884",
)

# close the client
client.close()

Or you can use the context manager, in which case you don't need to close the client manually:

with Client() as client:
    results = client.autocomplete("Kempe")

AsyncClient

Usage is very similar to Client, except that all methods are coroutines:

# use await for all methods
results = await client.autocomplete("Kempe")

# use await for closing the client
await client.close()

Also the context manager is async:

async with AsyncClient() as client:
    results = await client.autocomplete("Kempe")

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This project is not officially associated with or endorsed by OLA. Use of the OLA Maps API is subject to OLA's terms of service.

Metadata

Release files for olamaps 0.5.2

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

Source distribution (sdist)

Source distribution for olamaps 0.5.2
File Size Uploaded
olamaps-0.5.2.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for olamaps 0.5.2
File Interpreter ABI Platform
olamaps-0.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / olamaps-0.5.2.tar.gz

Download URL olamaps-0.5.2.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d98896816ccfee2b515dc0a3ca6cd7f871da0a9968fe786fa9bd023a3ba1904e
BLAKE2b-256 checksum
How to use checksums
83b18389cfb15c548a64bdc751b5796ced63668161e23430d66b38bd05b2c010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / olamaps-0.5.2-py3-none-any.whl

Download URL olamaps-0.5.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d974b7869a2baa93e241b4c1e0c90b4633ae6f69fbe4e719f8f6e28275948e91
BLAKE2b-256 checksum
How to use checksums
ef611f59b025d3794e58e0adac923bda181db7e5609b354a114e1c35034f8460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

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