StarNumber12046 / BeReal.py

Python BeReal API wrapper
3 stars 1 forks source link

Unable to get demo code to work #3

Open CyberTimon opened 8 months ago

CyberTimon commented 8 months ago

Hello!

When executing the plain demo code, everything up to date, I get this error:

...
Building wheels for collected packages: BeReal
  Building wheel for BeReal (setup.py) ... done
  Created wheel for BeReal: filename=BeReal-1.0.0-py3-none-any.whl size=6527 sha256=f96c1aeb774d791676c549c115fc42bf84cd58249141c0c01232b8e0ed80cd8f
  Stored in directory: /tmp/pip-ephem-wheel-cache-slrfhkj8/wheels/77/bc/51/5d252cce15658f9db5f0b895c4a1f795b500678411b98baa56
Successfully built BeReal
DEPRECATION: torchsde 0.2.5 has a non-standard dependency specifier numpy>=1.19.*; python_version >= "3.7". pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of torchsde or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: BeReal
Successfully installed BeReal-1.0.0

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: python3 -m pip install --upgrade pip
cybertimon@server:~/Repositories/Python_Experiments$ python3 befake.py 
Traceback (most recent call last):
  File "/home/cybertimon/Repositories/Python_Experiments/befake.py", line 3, in <module>
    client = BeReal.client("+41782089223")
AttributeError: module 'BeReal' has no attribute 'client'

After digging the code and renaming client to BeReal, I get this:

Building wheels for collected packages: BeReal
  Building wheel for BeReal (setup.py) ... done
  Created wheel for BeReal: filename=BeReal-1.0.0-py3-none-any.whl size=6527 sha256=f96c1aeb774d791676c549c115fc42bf84cd58249141c0c01232b8e0ed80cd8f
  Stored in directory: /tmp/pip-ephem-wheel-cache-slrfhkj8/wheels/77/bc/51/5d252cce15658f9db5f0b895c4a1f795b500678411b98baa56
Successfully built BeReal
DEPRECATION: torchsde 0.2.5 has a non-standard dependency specifier numpy>=1.19.*; python_version >= "3.7". pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of torchsde or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: BeReal
Successfully installed BeReal-1.0.0

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: python3 -m pip install --upgrade pip
cybertimon@server:~/Repositories/Python_Experiments$ python3 befake.py 
Traceback (most recent call last):
  File "/home/cybertimon/Repositories/Python_Experiments/befake.py", line 3, in <module>
    client = BeReal.client("+41782089223")
AttributeError: module 'BeReal' has no attribute 'client'

The python script looks like this (except for my blurred phone number):

import BeReal, json

client = BeReal.BeReal("+41*8*0*9**3")
# 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}")

Thanks for your help!

Kind regards Timon Käch

StarNumber12046 commented 8 months ago

it works for me, I'll try on a clean install. For now, try cloning the repo and installing from source like that. (first do pip uninstall BeReal.py)

CyberTimon commented 8 months ago

Thanks will test that again soon!