WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December 2016, so it is high time to update. This post is to introduce PyGLE, a Python wrapper for WiGLE.

What is WiGLE?

A quick refresher: WiGLE is the Wireless Geographic Logging Engine. Users can upload files containing details of WiFi networks they have seen, including their geographic location. This information can then be searched by WiGLE users. For example, you may be looking for open WiFi networks in your area. If a user has previously mapped your area using an app like WiGLE WiFi Wardriving, you can find these simply using the online map.

You can also use it to check out the WiFi density of a location as in the image below.

WiGLE North America

Introducing PyGLE

Install PyGLE for Python 2 or Python 3 using pip install pygle

You’ll also need to set up an account with WiGLE. You’ll notice that if you use the API a lot (for example when testing/developing an API wrapper!) then you’ll hit a rate limit. In this case, you can either slow down, or contact WiGLE about licensing options.

Using the API wrapper is very much like using the API itself. PyGLE has four modules, corresponding to the four sections of the WiGLE API v2. So each section is a module in PyGLE and each API endpoint is a function in that module.

To use the API, first import the section, then call the endpoint function. So to perform an authenticated GET request against an endpoint:

This returns a dict, or raises an HTTPError if something went wrong.

Example code

To give a real-world example of how to use this, the following code fetches the BSSIDs of wireless access points in the vicinity, searches for them on WiGLE, and returns the mean latitude and longitude.

Jamie Bull | jamiebull1@gmail.com

Related Posts

Just a quick post to point out a couple of really useful tools. The first is a web-based tool for finding weather files for a location of interest. It’s similar to the Excel EPW finder tool we created a few years back, but much more modern looking. It is however missing a few of the […]

Eppy is a really useful library which I’ve written about several times, since before I really had anything to offer in terms of contributing code. Over the past year or so though, I’ve started to contribute back some of the changes and additions I’ve made while using eppy on academic and commercial projects. This post […]

This post fixes a need to be able to see what I’m doing when generating EnergyPlus geometry files, without needing to fire up SketchUp. The approach is pretty simple, combining eppy with the mplot3d library for matplotlib. This is a much more lightweight solution than using something like mayavi. The goal here was to see […]

1 Comment on “View EnergyPlus geometry in Python”

Leave a Reply

Your email address will not be published. Required fields are marked *