Skip to main content

Lex API

pip install lexapi

Lex is a personal ads service for queer people. It's a brilliant service, and if you fall under the target groups you should definitely go check it out.

This is a Python 3 API created from the work I did between early-mid 2020, gathering the web request data the app sent from my phone. Because of this work I was able to alert the Lex team one possible privacy vulnerability from the service, which has since been removed.

This work was performed with the help of Android-86x, and mitmproxy.

Lex relies on Google's Identity toolkit and Firebase to handle authentication, and relies on Chatkit to handle messaging, through a websockets interface.

Currently this API supports probably about half of the available functions, including feed-viewing and user profile updating. See Lex API/Currently missing

The functions are all named after their respective calls, so you can use Lex-api for examples of the expected responses.

Docmentation of the API calls themselves, along with IdentityToolkit authentication, and information about X-Goog-Spatula are contained in lex-api, the code itself should be clean enough to extend, but please open an issue if there's anything re: code style, etc. that I've messed up. Literally any improvements or iterations would be nice :)

This readme wouldn't be complete without a huge thanks to the Lex team for making such a cool and unique service :)

Example

# Importing:

    from lexapi import LexAPI
    lex = LexAPI()

# Logging in:

    # Pass the user's phone number
    lex.send_verification_code(phone_number)
    # User gets a message with the auth code, so now we can pass it
    lex.verify_phone_number(verification_code)
    # We are now logged in to the service, but we need the user's feed
    # preferences to get the feed, so:
    lex.get_user()

# Refreshing the token:

    lex.refresh_token()

# Getting the feed:

    lex.get_feed()

# or alternately:

    filters = {
        'max_age': 32,
        'filters': 'foo, bar'
    }
    lex.get_feed(filters)

Currently missing {#currently-missing id="0c2915c7-e3d5-4a80-95af-0c78880dd823"}

Currently missing functionality is:

  • Username / Instagram logging in, and logging out (It's on my TODO)
  • Because of the limitations of mitmproxy, and the updates to the service, posting new personals is not supported (It's on my TODO list to jury-rig something with HTTP/2 support so we can support adding new posts).
  • Because of the method they use with Chatkit, viewing anything but the most and posting messages cannot, and will not be supported by this API, as it requires a private encryption key stored in the application.

Metadata

Release files for lexapi 0.0.1

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

Source distribution (sdist)

Source distribution for lexapi 0.0.1
File Size Uploaded
lexapi-0.0.1.tar.gz 23.0 kB Details

Built distribution (wheel)

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

Total release size: 37.7 kB

Release files / lexapi-0.0.1.tar.gz

Download URL lexapi-0.0.1.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
04aa3a790ecd467779e09774760855c21fbf1964e4d3b33a6b38a6f2815b598d
BLAKE2b-256 checksum
How to use checksums
c8752eea51d7516104dc0bace7842404cf3ad4177ca330b33a0d05d966e542a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.1

Release files / lexapi-0.0.1-py3-none-any.whl

Download URL lexapi-0.0.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24bea6e6a8df8b28cf045aa2011144307244c3422a1d77ee4980d6e882b4474f
BLAKE2b-256 checksum
How to use checksums
98452d9925a28bf95b920f813a0fdce6f9d374636e683dea6fb6bffd259589ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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