Spivey
Published © MIT

How to Upload a File to Wia's REST API

Learn how to upload a file of any type (e.g. png, jpg, pdf or txt) to Wia.

BeginnerProtip30 minutes493
How to Upload a File to Wia's REST API

Things used in this project

Software apps and online services

Wia
Wia

Story

Read more

Code

file_upload_to_wia.py

Python
from wia import Wia
wia = Wia()
wia.access_token = 'your-device_secret_key'

file_name = name_of_your_file 
dir_path = os.path.dirname(os.path.realpath(__file__))
result = wia.Event.publish(name='file', file=open(dir_path + '/’ + file_name, 'rb'))

Credits

Spivey
82 projects • 59 followers
Tourist in a Tutu || US Born || Melbourne/Mexico/California Raised || New Yorker at ❤️ || SF to Dublin to be COO of Wia the best IoT startup
Thanks to Alan Donoghue.

Comments