Skip to main content

A library for decoding and encoding UULEs

Project description

pyuule

UULE's are Google's objects for referencing locations. This Python library allows you to encode and encode UULE's!

What is a UULE anyway?

There are two forms of UULE. The first type, prefixed by a 'w+':

w+CAIQICIhTm90dGluZ2hhbSxFbmdsYW5kLFVuaXRlZCBLaW5nZG9t

can be used to direct searches to a specific location. The "canonical location" name must be drawn from Google's list of place names. A search on Google can then be done with results drawn from the area around this location with a UULE query parameter added, for e.g. the following search is scoped to results near the location of Nottingham in the UK: www.google.com/search?q=restaurants&uule=w+CAIQICIhTm90dGluZ2hhbSxFbmdsYW5kLFVuaXRlZCBLaW5nZG9t

The second type of UULE is often attached to cookies from Google, for e.g.:

a+cm9sZToxCnByb2R1Y2VyOjEyCnByb3ZlbmFuY2U6MAp0aW1lc3RhbXA6MTY4MDg3NzkwNjIzNjczNgpsYXRsbmd7CmxhdGl0dWRlX2U3OjMwMjY2NjY2MApsb25naXR1ZGVfZTc6LTk3NzMzMzMwMAp9CnJhZGl1czotMQo

These encode some metadata, but most interestingly, the radius over which to search, and the latitude and longitude of the searcher.

Usage

This library allows you to encode and decode query parameter UULE's:

>>> import pyuule

>>> pyuule.decode_w("w+CAIQICImV2VzdCBOZXcgWW9yayxOZXcgSmVyc2V5LFVuaXRlZCBTdGF0ZXM")
"Nottingham,England,United Kingdom"

>>> pyuule.encode_w("Saint-Germain-des-Pres,Ile-de-France,France")
"w+CAIQICIrU2FpbnQtR2VybWFpbi1kZXMtUHJlcyxJbGUtZGUtRnJhbmNlLEZyYW5jZQ"

and additionaly allows you to decode cookie UULEs:

>>> pyuule.decode_a("a+cm9sZToxCnByb2R1Y2VyOjEyCnByb3ZlbmFuY2U6MAp0aW1lc3RhbXA6MTY4MDg3NzkwNjIzNjczNgpsYXRsbmd7CmxhdGl0dWRlX2U3OjMwMjY2NjY2MApsb25naXR1ZGVfZTc6LTk3NzMzMzMwMAp9CnJhZGl1czotMQo")
{
    "role": 1,
    "producer": 12,
    "provenance": 0,
    "timestamp": 1680877906236736,
    "latitude": 3.0266666,
    "longitude": -9.77333300,
    "radius": -1,
:   

Acknowledgements

The following blog post was helpful in writing this library: https://valentin.app/uule.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyuule-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

pyuule-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pyuule-0.1.0.tar.gz.

File metadata

  • Download URL: pyuule-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.11.3 Darwin/20.6.0

File hashes

Hashes for pyuule-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b7e9eab61bdd08e2d8ecd3f659a617ef7b5dc648df8df057f0f5897ba5084d9
MD5 469f6d5cd211ba990b4ffbcc5f471670
BLAKE2b-256 055d553db5fb5df1078aad639ca78233be515d4c9d61aafe597af1e636046536

See more details on using hashes here.

File details

Details for the file pyuule-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyuule-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.11.3 Darwin/20.6.0

File hashes

Hashes for pyuule-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 537bbd98aba6f65cd8c0e7873e78ab2d9312f425c2fe1a3f4f93c7d121cba003
MD5 a3b6aed4568afd4160474915677dc2f7
BLAKE2b-256 39b9ca83344599a3122f49e44001a452a6f0e8259d752d7da826bcf67f0ea709

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page