DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Vamsi Krishna
Vamsi Krishna

Posted on

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)

๐ŸŒš Life is too short to browse without dark mode