Skip to main content

Build Status Kritika Analysis Status PyPI version

OpenCage Data Geocoding Module for Python

A Python module that uses OpenCage Data's geocoder.

Usage

Install the module:

pip install opencage

Load the module:

from opencage.geocoder import OpenCageGeocode

Create an instance of the geocoder module, passing a valid OpenCage Data Geocoder API key as a parameter to the geocoder modules's constructor:

key = 'your-api-key-here'
geocoder = OpenCageGeocode(key)

Pass a string containing the query or address to be geocoded to the modules's geocode method:

query = "82 Clerkenwell Road, London";
result = geocoder.geocode(query)

You can add additional parameters:

result = geocoder.geocode('London', no_annotations=1, language='es')

Reverse geocoding

Turn a lat/long into an address with the reverse_geocode method:

results = geocoder.reverse_geocode(51.51024, -0.10303)

Exceptions

If anything goes wrong, then an exception will be raised:

  • InvalidInputError for non-unicode query strings
  • UnknownError if there's some problem with the API (bad results, 500 status code, etc)
  • RateLimitExceededError if you go past your rate limit

Metadata

Release files for opencage 1.1.6

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

Source distribution (sdist)

Source distribution for opencage 1.1.6
File Size Uploaded
opencage-1.1.6.tar.gz 4.5 kB Details

Built distribution (wheel)

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

Total release size: 9.9 kB

Release files / opencage-1.1.6.tar.gz

Download URL opencage-1.1.6.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fdb5a9f346ed354e4075d234a359c558c04fdce6df3de803babbce3ae1bb19e3
BLAKE2b-256 checksum
How to use checksums
34891b5818efcd5882bd4a299466937720541539a61b655f3530f1951b56ec34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

Release files / opencage-1.1.6-py3-none-any.whl

Download URL opencage-1.1.6-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2c2a84228fedd1dddfca8c819e412f28bb45adb5e5dc6c3d743abf512e26637
BLAKE2b-256 checksum
How to use checksums
b31db62f20327fc0cc6e61d64748cbf92fefd1beab875090decb54ae190c6048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

Release history Release notifications | RSS feed

3.4.0

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

This release

1.1.6 This release

2 release files

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1.1.1

1 release file

1.1.0

1 release file

1.0.1

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