You can download this code by clicking the button below.
This code is now available for download.
This function makes an HTTP GET request to the API at https://randomuser.me/ to fetch random user data. The API returns data in JSON format, which the function parses into a Python dictionary.
Technology Stack : requests
Code Type : HTTP request
Code Difficulty : Intermediate
import requests
import random
def fetch_random_user_data():
url = 'https://randomuser.me/api/'
response = requests.get(url)
data = response.json()
return data