[Python] Creating gmail accounts with Python

Discussão em 'Python' iniciado por Stack, Maio 31, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to create a gmail account with Python using an article I found on medium. Here's the article: https://betterprogramming.pub/creating-temporary-gmails-accounts-with-python-9c200c52ebb7

    Here is my code:

    def generate_gmail(ID: int):

    # access the API
    url = "https://temp-gmail.p.rapidapi.com/get"
    querystring = {"id":ID,"type":"alias"}
    headers = {
    'x-rapidapi-host': "temp-gmail.p.rapidapi.com",
    'x-rapidapi-key': "YOUR PRIVATE KEY"
    }

    # send a request to the API
    response = requests.request("GET", url, headers=headers, params=querystring)

    # convert the response to JSON format
    json_response = response.json()
    # get gmail address
    gmail = json_response['items']['username']
    # get gmail password
    password = json_response['items']['key']

    print('Gmail address: %s' % str(gmail))
    print('Password: %s' % str(password))


    I have input my private key. When I run the code with python3 file_name.py in terminal I do not receive an output of an email and password. What am I doing wrong?

    Continue reading...

Compartilhe esta Página