Skip to main content

An API for the Lex app

Project description

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.

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

lexapi-0.0.1.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lexapi-0.0.1-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file lexapi-0.0.1.tar.gz.

File metadata

  • Download URL: lexapi-0.0.1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for lexapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 04aa3a790ecd467779e09774760855c21fbf1964e4d3b33a6b38a6f2815b598d
MD5 16f9e5785812417beb5a8a0901cd5688
BLAKE2b-256 c8752eea51d7516104dc0bace7842404cf3ad4177ca330b33a0d05d966e542a2

See more details on using hashes here.

File details

Details for the file lexapi-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lexapi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for lexapi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24bea6e6a8df8b28cf045aa2011144307244c3422a1d77ee4980d6e882b4474f
MD5 f4246c499eaaef1c94ab71a14ff90148
BLAKE2b-256 98452d9925a28bf95b920f813a0fdce6f9d374636e683dea6fb6bffd259589ad

See more details on using hashes here.

Supported by

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