Activity Generator using python

Are you Getting bored?

So now python will suggest you some activity.

So here we are going to learn how we can make activity generator using python

For making this project we are going to use api

Structure of data:

So we will divide our code in two part in first part we will import required library in second steps we can fetch the data from API

So steps no.1

Here we are dealing with API so we have to install requests library so for that just need to open terminal and write below command

pip install requests

Now we will use this

import requests

So now the last step

url = “”

def activitygenerator():

   Data = requests.get(url)

   json_data = Data.json()

   activity_Data = json_data[“activity”]

   activity_type = json_data[“type”]




Here i have created one variable where we have stored API url after that we have created one function and getting the data from API , as data is in dictionary format we are using key here 

At the end we just called the function

Full code:


Also check out the video tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *