繁体   English   中英

朋友你好,我想分开几封邮件看看哪些已经创建,哪些还没有创建

[英]Hello friends, I want to separate a few emails to see which ones have been created and which ones have not been created yet

看到这个:

import requests
from bs4 import BeautifulSoup

list1 = []
for i in range(0, 1000):
    user = "haji1" + str(i) + "7"
    if len(user) == 7:
        user = user[:5] + "00" + user[5:]
    elif len(user) == 8:
        user = user[:5] + "0" + user[5:]
    list1.append(user + "@gmail.come")
req = requests.get(
    "https://accounts.google.com/signin/v2/identifier?hl\
    =en&continue=https%\3A%\2F%\2Fmail.google.com%\2Fmail&servi\
        ce=mail&flowName=GlifWebSignIn&flowEntry=AddSession"
)
soup = BeautifulSoup(req, "html.parser")
print(soup)
Traceback (most recent call last):
  File "c:/Users/MR/Desktop/tekrar1.py", line 14, in <module>
    soup=BeautifulSoup(req,'html.parser')
  File "C:\Users\MR\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bs4\__init__.py", line 287, in __init__
    elif len(markup) <= 256 and (
TypeError: object of type 'Response' has no len()

我不确定您的代码最终应该做什么(请记住,自动请求是让您被 Google 屏蔽的万无一失的方法),但您只是错过了对响应文本的访问权限:

resp = requests.get("https://accounts.google.com/signin/v2/identifier...")
resp.raise_for_status()  # raise an exception if there was an error
soup = BeautifulSoup(resp.text, "html.parser")  # see "resp.text"
print(soup)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM