The application of requests - publishing events to the Internet

In the previous example, we retrieved information from the Internet. Let's consider an example where we have to publish a sensor event somewhere on the Internet. This could be either a cat door opening while you are away from home or someone at your doorstep stepping on the doormat. Because we discussed interfacing sensors to the Raspberry Pi Zero in the previous chapter, let's discuss a scenario where we could post these events to Slacka workplace communication tool, Twitter, or cloud services such as Phant (https://data.sparkfun.com/).

In this example, we will post these events to Slack using requests. Let's send a direct message to ourselves on Slack whenever a sensor event ...

Get Python Programming with Raspberry Pi now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.