DEV Community

Vamsi Krishna
Vamsi Krishna

Posted on

2 3

How to fetch API in Python 🔥

We can create Awesome Projects If we know how to fetch an API in python.

We all know python is the most easiest and widely used programming language even though it is slow.

so in this blog we will learn how to fetch an API in python.
we will use an API which will give us a list of words.

API -- Click Here

import requests
import json

# fetching API 
response_API = requests.get('https://www.randomlists.com/data/words.json')
data = response_API.text # gives in a text format

# converting it into json object
json_data = json.loads(data)

# getting list of words
words = json_data["data"]
print(words)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

👋 Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spirits—leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay