EXCLUSIVE TRAINING: Learn Robotics At Home & Unlock Highly Desirable $100,000 Tech Skills to Advance Your Career

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

How to fetch data from dweet.io using Python (Tutorial)

Disclosure: Some of the links below are affiliate links. This means that, at zero cost to you, I will earn an affiliate commission if you click through the link and finalize a purchase. Learn Robotics is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a way for websites to earn advertising revenues by advertising and linking to Amazon.com.

Learn Robotics At Home & Gain Highly Desirable $100,000 Tech Skills to Advance Your Career… for ‘Absolute Beginners’ looking to learn robotics at home …without needing access to a robotics lab!

For this tutorial, I’m going to walk you through the process of fetching data from dweet.io using Python.

Fetch Data from dweet.io using Python

dweet.io is a website that is similar to twitter but for connected devices. You can access sensor readings through a dweet.io URL in a JSON format. We will use this website to fetch data using a Python script.

Before we begin, I recommend that you have some prior knowledge of Python. We’ll be using Python3 for this lesson, but the libraries for this exercise work with previous releases of Python.

If you don’t know Python or aren’t familiar with dictionaries, loops, syntax, or connecting to webpages to retrieve data, then I recommend taking an introductory Python class before trying this tutorial. Feel free to try this tutorial out if you have some experience with Python. Just know that I won’t be covering common syntax or explaining every detail.

I’ve linked to the Python for Everybody webpage. This material is also offered on Coursera as a 5-class specialization. You can also take the Complete Python Bootcamp on Udemy. I highly recommend taking one of these courses if you want a thorough understanding of the fundamentals of Python.

Setup & Configuration

I’ve listed all the things you’ll need to complete this project.

You’ll need to code on a laptop computer (Mac, Windows, or Linux). You won’t be able to complete this project using a tablet or iPad.

Install Python on your computer. (Windows Tutorial | Mac Tutorial)

You’ll also be prompted to install a text editor for Python. Feel free to choose whatever text editor you like. I recommend Atom.io or Sublime Text. This tutorial will be showing you screenshots from Atom.io

Download the dweepy repository from Github. Follow the instructions in the README to setup dweepy.

Getting started with dweet.io

The dweet.io website gives you the option to have public (unlocked) or private (locked) devices. All of the unlocked devices are listed on the Discover page. We will be using a random unlocked device for this tutorial. You have the option when you’re developing your own devices to lock or unlock them. Locks are $1.99/mo and will keep your sensor data private.

Since we are just fetching data, we won’t need any actual hardware configured. You can learn how to send data to dweet.io with a Wemos D1 Mini (ESP8266) in this tutorial.

Navigate to the Discover Page on dweet.io

Your list of devices will vary from the screenshot below. Select one that has a few streams. I’m going to choose the “theBHVbooktemper2017” thing and capture Temperature & Humidity data.

fetch data from dweet.io using Python

Next, click on the name of the thing. It will open up a webpage and show you recent data.

fetch data from dweet.io using Python

Create the retrieve.py script to fetch data from dweet.io

Navigate to the folder where you installed the dweepy repository. Open up the dweepy folder and create a new Python script. Your Python file must be located inside the dweepy Github folder or you’ll receive an error when you run the script. I’ve called mine “retrieve.py”

We’re going to use the features of the dweepy repository to connect to theBHVbooktemper2017 and fetch these readings.

The script will work by prompting the user for a thing name. Next, we will use the dweepy repository to connect to the URL on dweet.io to obtain readings as a JSON file.

We can then parse the JSON using key-value pairs (from dictionaries) in Python. Lastly, we’ll print these readings in Terminal for the user to see. Here’s what you get once it’s all setup!

fetch data from dweet.io using Python

Code walk-through video

Since this code is simple enough to replicate, I’ve compiled a code walk-through video. Use this to gather inspiration for your solution! You can also download a copy of the example code below!

Subscribe to Unlock

Get the code and downloads for this project!


If you like these types of videos, be sure to subscribe to the Learn Robotics YouTube Channel

Next Steps

In the next tutorial, I’m going to show you how to log data from dweet.io into a local database.

If you liked this article, be sure to share it with a friend! And as always, if you have any questions, drop them below!

Botly Learn Robotics

Get Exclusive Learn Robotics Projects Directly to Your Inbox!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Did this content help you? 🤖
...say thanks and send us a coffee!


Learn Robotics At Home & Gain Highly Desirable $100,000 Tech Skills to Advance Your Career

For ‘Absolute Beginners’ looking to learn robotics at home …without needing access to a robotics lab


Learn Robotics helps self-starters, hobbyists, and tech professionals get started in the robotics industry. 

We leverage a simple formula to make it easy to gain highly marketable and high-value 6-figure robotics & automation skills. 

Learn Robotics was founded by Robotics Engineer, Liz Miller, and leverages the Robotics Success Equation, our unique methodology that helps people learn to build robots while enhancing their careers for the future.

liz's featured robotics PROJECT ON YOUTUBE

Learn Robotics Botly Favicon


Get Liz's Exclusive Robotics Content Directly to Your Inbox

Liz Miller Learn Robotics