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: [email protected]

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: [email protected]
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: [email protected]
    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
  Retrieve website content using Python? Vadanane 1 1,197 Jan-16-2023, 09:55 AM
Last Post: Axel_Erfurt
  POST requests - different requests return the same response Default_001 3 1,901 Mar-10-2022, 11:26 PM
Last Post: Default_001
  Python Obstacles | Krav Maga | Wiki Scraped Content [Column Copy] BrandonKastning 4 2,161 Jan-03-2022, 06:59 AM
Last Post: BrandonKastning
  Python Obstacles | Kapap | Wiki Scraped Content [Column Nulling] BrandonKastning 2 1,687 Jan-03-2022, 04:26 AM
Last Post: BrandonKastning
  Python Web Scraping can not getting all HTML content yqqwe123 0 1,616 Aug-02-2021, 08:56 AM
Last Post: yqqwe123
  Problem with logging in on website - python w/ requests GoldeNx 6 5,210 Sep-25-2020, 10:52 AM
Last Post: snippsat
  How to perform a successful login(signin) through Requests in Python Kalet 1 2,305 Apr-24-2020, 01:44 AM
Last Post: Larz60+
  Scraping problems with Python requests. gtlhbkkj 1 1,833 Jan-22-2020, 11:00 AM
Last Post: gtlhbkkj
  requests problem abdlwafitahiri 1 1,684 Dec-26-2019, 12:18 PM
Last Post: buran
  "I'm Feeling Lucky" script problem (again) tab_lo_lo 7 7,717 Jul-23-2019, 11:26 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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