[ayuda] pitón con proyecto de apertura de membresía ilimitada

Iniciado por rfve, Agosto 06, 2020, 06:14:55 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Agosto 06, 2020, 06:14:55 AM Ultima modificación: Agosto 06, 2020, 06:59:19 AM por Gabriela
Hola
Propósito:
1-n para producir correos electrónicos
2-n para generar contraseñas
3- Para crear n miembros en total.

Sólo estoy aprendiendo a codificar pitones. Quiero hacer un nuevo proyecto basado en el proyecto a continuación.
pero no tuve éxito

Siento lo de mi español. traducción de Google. :)

Código: php
import requests
import random
from random import getrandbits
import time

session = requests.session()

url = 'https://www.trendyol.com/login'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'}


email = 'test+{}@gmail.com'.format(getrandbits(40)) #enter your email, dont     change anything after '+'
password = 'Testing1234' #enter your password, minimum 8 characters

times = int(input("[" + (time.strftime("%H:%M:%S") + "]" + " - Enter the number of account(s) you would like to create: ")))
text_file = open("chmielna accounts.txt", "w")

def create_account():
    print("[" + (time.strftime("%H:%M:%S")) + "]" + " - SUBMITTING INFO.....")
    global session
    global email
    payload = {
        "RegisterModel_Email": email,
        "RegisterModel_Password": password,
        "newTermsOfUse": "on"
    }

def write():
    text_file.write(email + ":" + password + "\n")
    if "Success" in response.text:
        print("[" + (time.strftime("%H:%M:%S")) + "]" +" - SUCCESSFULLY CREATED     ACCOUNT "+email+":"+password)
        write()
    else:
        print("[" + (time.strftime("%H:%M:%S")) + "]" +" - ERROR COULD NOT CREATE "+email+":"+password)

for i in range (times):
    create_account()


La respuesta del código es la siguiente. No es inoperante.


HI @No tienes permitido ver los links. Registrarse o Entrar a mi cuenta,

As with this question No tienes permitido ver los links. Registrarse o Entrar a mi cuenta the problem is that the code is making no request at all, it is just defining the variables, you need to make the post request using the requests python library, something like this

Código: php

x = requests.post(url, data = payload, headers = headers)


There are other things you have to be aware of

- I saw the page you put in the code and I noticed the form action is actually "No tienes permitido ver los links. Registrarse o Entrar a mi cuenta" instead of "No tienes permitido ver los links. Registrarse o Entrar a mi cuenta"
- There is a hidden field named "__RequestVerificationToken" which has a value that changes everytime you visit the page. This is the csrf validation token and you have to include it in your request otherwise the server will reject any of them. Maybe this SO answer will help you: No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
- Last but not least, I don't know exactly how python deals with SSL, but because the page you are trying to connect to has https you need to include the certificate or maybe disable the verification for SSL. I found this No tienes permitido ver los links. Registrarse o Entrar a mi cuenta