Skip to main content Skip to navigation
hero
Sachin Ghait·Jul 12, 2021·5 min read

TL;DR: Most websites expose REST APIs that power their UI -- but these same APIs can be called directly from Python scripts to automate tasks. Using the requests module, you can build scripts that monitor bitcoin/product prices, fetch images from Nat Geo's photo of the day, and even set them as your desktop background. This post introduces the concept and walks through practical automation examples.

Automate Rest API tasks using python requests module.

Many websites use rest APIs to interact with their backend, (Others may use sockets or GRPC or something else). UI is a simple way to interact with Rest APIs ( simple to interact for a normal user ).

There are other ways these APIs can be used. They can be invoked directly from python(or any other language) scripts.

An API can be used to fetch some data or trigger some operation at server. I am listing down some examples, where I have used Rest APIs to automate some tasks.

  1. Monitor bitcoin price or price of any item on shopping website.
  2. Fetch images from nat geo photo of the day page and set it as desktop background.