python - 我想创建一个帐户生成器,但它给了我一个 404 on request URL
问题描述
这是我的代码,我真的不知道每次运行 URL 确实存在的代码时它给我一个 404 的问题是什么。任何帮助表示赞赏,顺便说一句,我对请求很陌生。据我所知,该网站没有太多保护,它也使用 cloudflare,但在检查浏览器的地方并不多。 </p>
import requests
import randominfo
from requests.models import Response
import random
import string
import time
lenght = 15
lower = string.ascii_lowercase
upper = string.ascii_uppercase
num = string.digits
sym = string.punctuation
all = lower + upper + num + sym
temp = random.sample(all,lenght)
password = "".join(temp)
with open(path, 'r') as configFile:
catchall = configFile.read()
login = randominfo.get_first_name() + '.' + randominfo.get_last_name() + catchall
passwordInput = password
passwordVeryfication = password
URLGet = 'https://de.afew-store.com'
url = 'https://de.afew-store.com/account/register'
RequestHeaders = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'referer': 'https://de.afew-store.com/',
'content-language': 'de',
'method': 'POST',
'server': 'cloudflare',
'x-content-type-options': 'nosniff',
'path': 'account',
'scheme': 'https',
}
getHeaders = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'location': 'https://de.afew-store.com/',
'server': 'cloudflare',
'x-content-type-options': 'nosniff',
'path': 'account',
'scheme': 'https',
}
firstName = randominfo.get_first_name()
lastName = randominfo.get_last_name()
customerEmail = firstName + lastName + catchall
s = requests.session()
signup = s.get(URLGet, headers=getHeaders)
payload = {
'form_type': 'create_customer',
'utf8': '✓',
'customer[tags]': 'lang:en',
'customer[first_name]': firstName,
'customer[last_name]': lastName,
'customer[email]': customerEmail,
'customer[password]': password,
}
login_info = s.post(url, headers=RequestHeaders, data=payload)
print(login_info.status_code)
解决方案
主机https://de.aew-store.com未知。也许你打错了
ping https://de.afew-store.com
ping: cannot resolve https://de.afew-store.com: Unknown host
推荐阅读
- spring - Spring Boot 应用程序在 AutoConfigurationImportFilter 上失败,无法构建但未指定类
- laravel - isLocal() 在 Laravel 中实际上做了什么?
- r - 节点标签在 ggraph 和 ggsave 中被截断
- reactjs - 任务“:app:bundleDevReleaseJsAndAssets”执行失败
- mysql - MySQL ORDER 按列中的一个特定值(具有逗号分隔值)
- javascript - vue-infinite-loading的Javascript数组问题
- asp.net-core - 如何按需编译 Razor 模板?
- c# - 使用没有 ASP.NET 标识的 ASP.NET OAuth 提供程序
- powershell - 如何使用 Powershell over Octopus 创建 Nginx IIS LoadBalancer?
- node.js - 我的注册路线有误