Random User Information Fetching Function

  • Share this:

Code introduction


This function fetches a random user's personal information by calling the randomuser.me API.


Technology Stack : requests, json

Code Type : API call

Code Difficulty : Intermediate


                
                    
import requests
import random

def fetch_random_user():
    url = 'https://randomuser.me/api/'
    response = requests.get(url)
    data = response.json()
    return data

# JSON Explanation                
              
Tags: