Skip to main content
https://badge.fury.io/py/doko.png https://travis-ci.org/larsyencken/doko.png?branch=master https://pypip.in/d/doko/badge.png

A simple command-line utility (and Python module) to determine your current location.

Doko is a clone of Victor Jalencas’s whereami utility, but unlike whereami it supports multiple strategies for finding your location.

Kudos to Richo Healey for ideas and patches.

Installing

With GeoIP

Using GeoIP is the default. To install just GeoIP support, run:

$ pip install doko

Then you’ll need to download a MaxMind free GeoIP2 database, unzip it and set the GEOIP2_FILE environment variable to point to it.

With Core Location

However, on OS X 10.6 (Snow Leopard) or later, you can also use the much more accurate Core Location framework:

$ pip install doko[corelocation]

The corelocation dependencies take much longer to install, so go make a coffee. In fact, make several coffees.

Once you’ve installed the corelocation-enabled doko package, you’ll need to enable Core Location in System Preferences, in the “Security” or “Security & Privacy” section. Furthermore, you must be using Wifi for it to work.

Hacking

For hacking on OSX, you will likely want to install requires-corelocation.txt as well as requires.txt.

Run the tests with make test.

Using on the command-line

Just run the doko command:

$ doko
35.674,139.701

This will give its best guess as to your location, depending on the strategies that are available. Use the --show option to open the location in Google Maps.

More fine-grained control over strategies used and the precision returned is available. See doko --help.

Using as a module

> import doko
> doko.location('geoip')  # on any platform
Location(latitude=35.674, longitude=139.701, source='geoip')
> doko.location('corelocation')  # on OS X, using Core Location
Location(latitude=35.674851, longitude=139.701419, source='corelocation')
> doko.Location.set_precision(2)
> doko.location()
Location(latitude=35.67, longitude=139.70, source='corelocation')

Landmarks

You can use the doko-landmark command to store known landmarks, which you can then specify to doko using the DOKO_LANDMARK environment variable. This is useful if you’re somewhere you go often without GPS:

$ doko-landmark --add ueno-park 35.713965 139.77411
$ doko-landmark --list
ueno-park [35.713965, 139.77411]
$ doko  # will give its best guess
35.674851,139.70141
$ DOKO_LANDMARK=ueno-park doko  # will use the landmark
35.713965,139.77411

Changelog

0.4.0

  • Migrate to geoip2 database instead of web service

  • Give instructions for downloading and installing db to GEOIP2_FILE

  • Run tests and lint using make

0.3.1

  • Make setup.py dependencies more flexible.

0.3.0

  • Add a means for storing and using known landmarks

  • Add a cache strategy enabled by --cache option

  • Include location source in Location tuple

  • Add --show-strategy option on the command-line

0.2.0

  • Make doko multiplatform, by making Core Location optional

  • Honour timeouts for GeoIP lookups

  • Provide control over precision to support privacy

0.1.0

  • Fetch latitude and longitude using Core Location

  • Provide backup method via GeoBytes page

Bitdeli badge

Metadata

Release files for doko 0.4.0

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

Source distribution (sdist)

Source distribution for doko 0.4.0
File Size Uploaded Provenance
doko-0.4.0.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for doko 0.4.0
File Interpreter ABI Platform
doko-0.4.0-py2-none-any.whl Python 2 none any Details

Total release size: 17.7 kB

Release files / doko-0.4.0.tar.gz

Download URL doko-0.4.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7b766905c617a254c17fa5522845aa5a9446f1bff1d8fb219097938d0ad2589f
BLAKE2b-256 checksum
How to use checksums
767521b277337b288c7a9eabdab4e70a6ea37dfa36acf86f8c1600bd5bca3ce1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / doko-0.4.0-py2-none-any.whl

Download URL doko-0.4.0-py2-none-any.whl
Size 9.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
c8a3c7dcf0f34fe52bf8c3ea8d8ffdeed35e4766d5cd4b69a6ac53b68fe305e9
BLAKE2b-256 checksum
How to use checksums
e46b2a11c9dfb43e0893300bf4ea16b6509eb0780cd554f0ef3ef3d169bcc9fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for doko 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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