# OLA Maps Python Package
A Python wrapper for the OLA Maps API, providing easy-to-use abstractions for developers.
[![Stable Version](https://img.shields.io/pypi/v/olamaps?label=stable)](https://pypi.org/project/olamaps/)
![Python Versions](https://img.shields.io/pypi/pyversions/olamaps)
[![Download Stats](https://img.shields.io/pypi/dm/olamaps)](https://pypistats.org/packages/olamaps)
## Supported APIs
- Autocomplete
- Geocoding
- Reverse geocoding
- Directions
## Usage
- [Installation](#installation)
- [Authentication](#authentication)
- [Client](#client)
- [AsyncClient](#asyncclient)
### Installation
Install the package using pip:
```
pip install olamaps
```
### Authentication
There are two ways to authenticate:
1. Using API key
```python
os.environ["OLAMAPS_API_KEY"] = "your_api_key"
# OR
client = Client(api_key="your_api_key")
```
2. Or using `client_id` and `client_secret`
```python
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
```python
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:
```python
with Client() as client:
results = client.autocomplete("Kempe")
```
### AsyncClient
Usage is very similar to Client, except that all methods are coroutines:
```python
# 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:
```python
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](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.
Raw data
{
"_id": null,
"home_page": "https://github.com/adayush/olamaps-python",
"name": "olamaps",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "ola, maps",
"author": "adayush",
"author_email": "adayush0@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/83/b1/8389cfb15c548a64bdc751b5796ced63668161e23430d66b38bd05b2c010/olamaps-0.5.2.tar.gz",
"platform": null,
"description": "# OLA Maps Python Package\n\nA Python wrapper for the OLA Maps API, providing easy-to-use abstractions for developers.\n\n[![Stable Version](https://img.shields.io/pypi/v/olamaps?label=stable)](https://pypi.org/project/olamaps/)\n![Python Versions](https://img.shields.io/pypi/pyversions/olamaps)\n[![Download Stats](https://img.shields.io/pypi/dm/olamaps)](https://pypistats.org/packages/olamaps)\n\n## Supported APIs\n\n- Autocomplete\n- Geocoding\n- Reverse geocoding\n- Directions\n\n## Usage\n\n- [Installation](#installation)\n- [Authentication](#authentication)\n- [Client](#client)\n- [AsyncClient](#asyncclient)\n\n### Installation\n\nInstall the package using pip:\n\n```\npip install olamaps\n```\n\n### Authentication\n\nThere are two ways to authenticate:\n\n1. Using API key\n\n ```python\n os.environ[\"OLAMAPS_API_KEY\"] = \"your_api_key\"\n\n # OR\n client = Client(api_key=\"your_api_key\")\n ```\n\n2. Or using `client_id` and `client_secret`\n\n ```python\n os.environ[\"OLAMAPS_CLIENT_ID\"] = \"your_client_id\"\n os.environ[\"OLAMAPS_CLIENT_SECRET\"] = \"your_client_secret\"\n\n # OR\n client = Client(client_id=\"your_client_id\", client_secret=\"your_client_secret\")\n ```\n\nFollow the same steps for AsyncClient as well.\n\n### Client\n\n```python\nfrom olamaps import Client\n\n# Initialize the client\nclient = Client()\n\n# Autocomplete a query\nresults = client.autocomplete(\"Kempe\")\n\n# Geocode an address\nresults = client.geocode(\"MG Road, Bangalore\")\n\n# Reverse geocode a latitude-longitude pair\nresults = client.reverse_geocode(lat=\"12.9519408\", lng=\"77.6381845\")\n\n# Get directions from one place to another\nresults = client.directions(\n origin=\"12.993103152916301,77.54332622119354\",\n destination=\"12.972006793201695,77.5800850011884\",\n)\n\n# close the client\nclient.close()\n```\n\nOr you can use the context manager, in which case you don't need to close the client manually:\n\n```python\nwith Client() as client:\n results = client.autocomplete(\"Kempe\")\n```\n\n### AsyncClient\n\nUsage is very similar to Client, except that all methods are coroutines:\n\n```python\n# use await for all methods\nresults = await client.autocomplete(\"Kempe\")\n\n# use await for closing the client\nawait client.close()\n```\n\nAlso the context manager is async:\n\n```python\nasync with AsyncClient() as client:\n results = await client.autocomplete(\"Kempe\")\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis project is not officially associated with or endorsed by OLA. Use of the OLA Maps API is subject to OLA's terms of service.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client library for Ola Maps API Web Services",
"version": "0.5.2",
"project_urls": {
"Homepage": "https://github.com/adayush/olamaps-python",
"Issues": "https://github.com/adayush/olamaps-python/issues",
"Repository": "https://github.com/adayush/olamaps-python"
},
"split_keywords": [
"ola",
" maps"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef611f59b025d3794e58e0adac923bda181db7e5609b354a114e1c35034f8460",
"md5": "0f943f839d6c15de593fc15700304d6b",
"sha256": "d974b7869a2baa93e241b4c1e0c90b4633ae6f69fbe4e719f8f6e28275948e91"
},
"downloads": -1,
"filename": "olamaps-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f943f839d6c15de593fc15700304d6b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 6628,
"upload_time": "2024-07-19T12:24:51",
"upload_time_iso_8601": "2024-07-19T12:24:51.181861Z",
"url": "https://files.pythonhosted.org/packages/ef/61/1f59b025d3794e58e0adac923bda181db7e5609b354a114e1c35034f8460/olamaps-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "83b18389cfb15c548a64bdc751b5796ced63668161e23430d66b38bd05b2c010",
"md5": "c734a8b48af8e31d8698a695ed9f5953",
"sha256": "d98896816ccfee2b515dc0a3ca6cd7f871da0a9968fe786fa9bd023a3ba1904e"
},
"downloads": -1,
"filename": "olamaps-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "c734a8b48af8e31d8698a695ed9f5953",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5234,
"upload_time": "2024-07-19T12:24:52",
"upload_time_iso_8601": "2024-07-19T12:24:52.566945Z",
"url": "https://files.pythonhosted.org/packages/83/b1/8389cfb15c548a64bdc751b5796ced63668161e23430d66b38bd05b2c010/olamaps-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-19 12:24:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adayush",
"github_project": "olamaps-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "olamaps"
}