StarNumber12046 / BeReal.py

Python BeReal API wrapper
3 stars 1 forks source link
bereal bereal-api python

[BROKEN] BeReal.py

A Python API wrapper for BeReal

[!CAUTION] This uses only reverse-engineered code. I am not to be held responsible for any consequences of the use of this library. Your account may be banned, you might get ratelimited, use this with caution.

This library is currently in a broken state due to changes in the API. Please see https://github.com/rvaidun/befake/issues/199

Installation

[!WARNING] For now the project is NOT on pypi.

# Windows:
pip install git+https://github.com/StarNumber12046/BeReal.py

# Macos/Linux:
pip3 install git+https://github.com/StarNumber12046/BeReal.py

Features

What I implemented

What is on the roadmap

Special thanks

Special thanks to macedonga with beunblurred for having already done part of the reverse engineering

Quick example

import BeReal, json

client = BeReal.client("+12345678901")
# Send and verify OTP
client.send_code()
otp = input("You should have received an authentication code. Please check your phone and enter it below.")
client.verify_code(otp)
# Initialize the client with BeReal-provided tokens
client.initialize_client()

# Save credentials
f = open("creds.json", "w")
f.write(json.dumps(client.save_session()))
f.close()

# Get logged in user
me = client.me()
print(f"Username: {me.username}")
for friend in me.friends:
    print(f"Friend: {friend.username}")

Pre-made examples

You can use my examples. Do it in this order:

  1. Example/auth.py (login)
  2. Example/example.py (actual data)
  3. (If the token expires) Example/refresh_token.py