Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free

"python" posts

  • By Miguel Grinberg
    Introducing Python Developer Miguel Grinberg Miguel Grinberg

    Hello everyone, my name is Miguel Grinberg, and I am super excited to join the Developer Voices team at Twilio.

    I have a Masters degree in Computer Science, and for the last few years I’ve been active in open source, mostly within the Python community. I live in a small rural village in Ireland. This is the peaceful and relaxing view that I have from my home office window:

    The view from my home office window

    I Love Code

    The main thing you need to know about me is that since my teenage years I have been a coder, and the more I code the more I like it.

    I learned to code writing video games in the BASIC programming language, on Texas Instruments and Commodore home computers. In those pre-Internet days there wasn’t much of a choice in computer languages, so after being unhappy with the lag in some of my BASIC games I taught myself …

    Read More
  • By Matt Makai
    Our Favorite Halloween Hacks using Python, Raspberry Pi, Arduino and More Halloween Hacks for 2019

    Today is Halloween and this holiday provides a wonderful excuse to hack on some spooky-themed projects.

    We've curated a few of our favorite Halloween hacks in this post, ranging from a Raspberry Pi-controlled pumpkin to a Dracula dark theme for your Terminal.

    Pumpkin Pi

    This cleverly-named Pumpkin Pi project combines a Raspberry Pi with some custom open source Python code and a carved-out pumpkin to create a high-tech Jack o'Lantern.Hardware part of the Pumpkin Pi hack, from http://begillespie.github.io/Pumpkin_Pi/

    The Jack o'Lantern can be controlled to change the colors of the LED lights inside the face and a motion sensor triggers a unique lighting sequence for people when they walk by.

    Spotify-Powered Halloween Sound Effects

    This Halloween Sound Effects using Spotify and Raspberry Pi project uses a Spotify playlist with Halloween sounds to power the hardware hack. Check out the accompanying video to see how it works.

    Dracula Dark Theme

    Dracula is a beautiful dark theme for Terminal, Sublime …

    Read More
  • By Matt Makai
    How to Broadcast SMS Text Messages from Python 3 Django Web Applications Broadcasting SMS Text Messages from Python Django Web Applications Tutorial

    Short Message Service (SMS) text messages are ubiquitous for time-sensitive communication. They’re also easy to send at scale by combining a Django web application with an application programming interface (API).

    In this tutorial, we will build a straightforward Django project with SMS capability that transmits messages to multiple recipients.

    If you want to go further in learning either Python or the Twilio SMS API, check out the amazing TwilioQuest training game.

    Required Project Dependencies

    Python 3 is required for this tutorial because Python 2 will no longer be supported after December 31, 2019. We’ll use Python 3.8 to build this tutorial.

    We will also use the following application dependencies in our application:

    If …

    Read More
  • By Sam Agnew
    Web Scraping and Parsing HTML in Python with Beautiful Soup Copy of Generic Blog Header 4.png

    The internet has an amazingly wide variety of information for human consumption. But this data is often difficult to access programmatically if it doesn't come in the form of a dedicated REST API. With Python tools like Beautiful Soup, you can scrape and parse this data directly from web pages to use for your projects and applications.

    Let's use the example of scraping MIDI data from the internet to train a neural network with Magenta that can generate classic Nintendo-sounding music. In order to do this, we'll need a set of MIDI music from old Nintendo games. Using Beautiful Soup we can get this data from the Video Game Music Archive.

    Getting started and setting up dependencies

    Before moving on, you will need to make sure you have an up to date version of Python 3 and pip installed. Make sure you create and activate …

    Read More
  • By Ubani Balogun
    Introducing Twilio's SOCless: Automated Security Runbooks Decorative header image "Introducing Twilio's SOCless: Automated Security Runbooks"

    How can an organization’s security team defend its customers against threats at scale?

    When the Twilio Security Operations team (SecOps) was founded, this challenge weighed heavily on our minds. We knew that automating all our threat investigation and response procedures would be key to safeguarding our customers, but we had no clue where to begin. We also knew that many of our peers were in the same boat.

    That’s why today, we’re proud to open-source SOCless: a serverless framework to help organizations easily automate their security workflows and respond to threats quickly and at scale.

    To get started with SOCless, visit the documentation at https://twilio-labs.github.io/socless/

    Building automated security runbooks

    When performing investigations and responding to threats, security professionals follow well-documented, pre-planned, step by step procedures. We call these procedures runbooks.

    A typical runbook may require a security professional to use multiple security products, custom scripts, and decision trees to …

    Read More
  • By Sam Agnew
    Training a Neural Network on MIDI data with Magenta and Python Copy of Generic Blog Header 3-5.png

    Since I started learning how to code, one thing that has always fascinated me was the concept of computers creating music. With Magenta, a Python library built that makes it easier to process music and image data, this can be done more easily than before. Magenta has pre-trained example models you can use to generate music, as seen in a previous blog post, but it's a lot more fun to create your own.

    Let's walk through how to use Magenta to train a neural network on a set of music data from classic Nintendo games to generate new Nintendo-sounding tunes.

    Super Mario Bros 2 GIF

    Installing Magenta

    First we need to install Magenta, which can be done using pip. Make sure you create a virtual environment before installing. I am using Python 3.6.5, but Magenta is compatible with both Python 2 and 3.

    Run the following command to install Magenta in your …

    Read More
  • By Sam Agnew
    Generating Nintendo Music Over the Phone in Python with Magenta and Twilio Copy of Generic Blog Header 1-3.png

    Artificial creativity is amazing, and I am always blown away by what people accomplish with neural networks. Lots of developers have used Python libraries like Magenta to create awesome music.

    I used Magenta to train a neural network on a bunch of classic Nintendo music, and I thought it would be fun to hack around with that and make a Twilio phone number you can call to hear computer-generated NES music. If you're in the US, try calling ‭(424) 398-8637‬ (424-39-TUNES) to hear!

    Let's walk through how to build a phone number that plays computer generated music using Magenta.

    Installing dependencies

    First we need to install Magenta, which can be done using pip. Make sure you create a virtual environment before moving forward. I am using Python 3.6.5, but Magenta is compatible with both Python 2 and 3.

    Run the following command to install Magenta in your …

    Read More
  • By Tilde Thurium
    Fighting Impostor Syndrome With Twilio Internet of Things Fighting-Impostor-Syndrome-Twilio-IoT

    If you’re reading this, you’ve probably grappled with impostor syndrome at one time or another.

    Experience doesn’t always help, either. As our skills grow, we tackle harder problems. Technologists are always working at the edge of our knowledge.

    What can we do to fight impostor syndrome? Studies have shown that self-affirmation can counteract negative ruminations and increase achievement.  So I decided to build an Internet of Things button that delivers an SMS affirmation when pressed.

    Physical responses to negative thoughts

    Why use hardware to fight imposter syndrome?

    This project could totally be a web application. But – taking a physical action in response to negative thoughts helps ground me emotionally.

    Using SMS lets me receive the affirmation without the cognitive load of opening another browser tab. Twilio’s IoT capabilities let me take the button anywhere with cell service. No WiFi configuration required!

    The imposter syndrome button was my first hardware …

    Read More
  • By Sam Agnew
    Working with MIDI data in Python using Mido Working with MIDI data in Python with Mido

    MIDI is an extremely popular and versatile format for music data, whether you're using it as a digital musical instrument interface or just transcribing music in it to show your bandmates new songs. Mido is a Python library you can use to interact with MIDI in your code.

    Let's walk through the basics of working with MIDI data using the Mido Python library.

    Setting up

    Before moving on, you will need to make sure you have an up to date version of Python 3 and pip installed. Make sure you create and activate a virtual environment before installing Mido.

    Run the following command to install Mido in your virtual environment:

    pip install mido==1.2.9

    In the rest of this post, we will be working with these two MIDI files as examples. Download them and save them to the directory where you want your code to run.

    VampireKillerCV1.mid …

    Read More
  • By Ryan Kauffman
    How to Make a Smart Baby Monitor with Python, Raspberry Pi, Twilio SMS, and Peripheral Sensors How to Make A Smart Baby Monitor with Python

    Have you ever wanted a smart monitor that not only lets you see your kids, but also texts you the temperature in their crib, so you can be certain they are comfortable? I certainly have!

    That’s why I made the Raspberry Pi (RPi) Smart Baby Monitor, and I want to show you how easy it is to build yourself using Twilio, a Raspberry Pi, and a little bit of code.

    Here's my son at 4 months old along with the smart baby monitor I created for him:

    Smart baby monitor

    The Tech Stack

    The IoT app we are going to create will use the Python programming language, a Raspberry Pi, a Raspberry Pi camera, a DS18B20 temperature sensor, and the Twilio SMS API:

    - Python version 3.5: The language we will write our code in

    - Raspberry Pi: Environment that will hold our software (code) and our hardware (peripherals)

    - RPi …

    Read More
  • Newer
    Sign up and start building
    Not ready yet? Talk to an expert.