Blynk HTTP API python wrapper

Hi, if somebody need a simple API wrapper on python for Blynk HTTP/HTTPS API you can use [this] (https://github.com/xandr2/blynkapi) simple lib.

With lib you can:

  • Read/write pin value
  • Check hardware network status
  • Check application network status
  • Send push notification
  • Send email
  • Get pin history data
  • Get QR for project cloning
  • Get project info
  • Query API

Installation

Install via pip

pip install blynkapi

after installation import it in your code

from blynkapi import Blynk

Using

# if you install it from pip, else use `from Blynk import *`
from blynkapi import Blynk
# vars
auth_token = "sdjflksjflkdsjfkldsjfkldfkldjflk"

# create objects
room_light = Blynk(auth_token, pin = "V3")
kitchen_light = Blynk(auth_token, pin = "V4")
house_door = Blynk(auth_token, pin = "V5")

# get current status
res = room_light.get_val()
print res

# set pin value to 1
room_light.on()
# set pin value to 0
room_light.off()

For more details visit GitHub repository
It is not fully tested on all API requests, if you find some bug or something else let me know.

2 Likes

when you create each Blynk() object, is a separate cloud connection created?

When you create object it doesn’t create a connection. It connects only when you run some command.

Oh, i see. This is only HTTP API wrapper.
It’s better to specify this, as most our clients do maintain the persistent connection…

Yes you are right! I updated the description.