vshymanskyy / blynk-library-python

Blynk library for Python. Works with Python 2, Python 3, MicroPython.

Home Page:https://blynk.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid auth token with both py libraries for Blynk console 2.0

bmustata opened this issue · comments

Hi,

Currently both libraries don't work with the new console 2.0.

https://github.com/blynkkk/blynk-library
https://github.com/vshymanskyy/blynk-library-python

I used the token from:
https://blynk.cloud/dashboard/...

import time
import logging
import BlynkLib

BLYNK_AUTH = 'auth code' #insert your Auth Token here

# initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

# @blynk.on("connected")
# def connect_handler(ping):
#     print('Blynk connected')

# @blynk.on("disconnected")
# def disconnect_handler():
#     print('Blynk disconnected')

print('starting device...')

# main loop that starts program and handles registered events
try:
    while True:
        blynk.run()
except KeyboardInterrupt:
    blynk.disconnect()
    print("Blynk disconnected!")

Error message

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.0 (Darwin)

starting device...
Invalid auth token

Try this library: [https://github.com/vshymanskyy/blynk-library-python/blob/master/BlynkLib.py]

The problem is you are using the older version of BlynkLib (v0.2.0) with the new auth token from blynk.cloud (v1.0.0). You are obviously installing your blynk for Python through the pip installation in which you should know/realize that it's not gonna be installing the latest version (v1.0.0) instead you got the legacy version because the pip wheel repository is yet to be updated to the latest version of BlynkLib 2.0 for some unknown reasons.

So, to install the latest version, be sure to git clone the blynk-library-python repository and then perform the manual compilation by:

pi@raspberrypi:~ $ cd blynk-library-python/
pi@raspberrypi:~/blynk-library-python $ sudo python setup.py install

Then you're gonna be using the latest version of BlynkLib.py

cheers from rtxsc

After downloading the file directly the code worked with no issue. Tks for the help!

Blynk Lib