python请求如何将数据发送到网站

静脉

我想使用请求库将数据发送到此站点,然后进行表决。您已完成以下操作:这是真的吗?

import time
import requests
from time import sleep

url = 'http://www.xtremetop100.com/in-post.php?site=1132347673' 
 s = requests.Session()
proxy = "8.8.8.8:8080"
s.headers.update({
'Host': 'www.xtremetop100.com',
'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:51.0) Gecko/20100101 Firefox/51.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Referer': 'http://www.xtremetop100.com/in.php?site=1132347673',
'DNT': '1',
'Connection': 'close',
'Upgrade-Insecure-Requests':'1',
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': '440',
})

proxy = {'http': 'http://' + proxy, 'https': 'https://' + proxy}
data = {
    'site' :"1132347673",
    'secure_captcha_check':"6110",
    'g-recaptcha-response':captcha_response,
    'ticki' :"Vote+for+ZeroConquer[New+Server]"
       }

Cookies =  { 'flowridaoookie':"1",'_gid':"GA1.2.1228802977.1547667122",'_gat_gtag_UA_116540956_1':"1",'_ga':"GA1.2.1330506724.1547667122",'__cfduid':cfduid,'__atuvs':"5c42ed6d02994f98001",'__atuvc':"156|3"}
response = s.post(url,data=data,Cookies=Cookies,proxies=proxy)
time.sleep(5)

打印response.status_code

我想验证发送者链接是否正确?Cookie的模式正确吗?

罗曼

嗨,首先:您不能因为它使用了验证码。但是如果您想了解更多有关python的信息,那么我修改了您的代码,使其能够正常工作,因为您的代码有一些错误,您可以看看我的代码,看看错误在哪里等,

import requests
from time import sleep
import random
url = 'http://www.xtremetop100.com/in-post.php?site=1132347673' 
#This is a list of proxy found on the internet
proxy = ["103.80.236.107:53281",
"185.32.47.250:8080",
"119.101.117.85:9999",
"41.84.135.114:53281",
"1.10.186.105:40161",
"143.255.52.102:40687",
"187.110.93.120:20183",
"60.6.241.72:808",
"176.197.145.246:32649",
"168.90.144.121:8080",
"159.192.202.122:8080",
"81.174.11.227:33803",
"185.34.17.248:58137",
"119.101.117.87:9999",
"182.160.127.53:39984",
"103.19.110.177:8080",
"91.219.235.12:8080",
"36.66.126.79:46650",
"125.26.99.222:57492"]

while True:
    try: #Try: to avoid the code to stop if a proxy don't work or something else don't work 
        s = requests.Session()
        s.headers.update({
        'Host': 'www.xtremetop100.com',
        'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:51.0) Gecko/20100101 Firefox/51.0',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Language': 'en-US,en;q=0.5',
        'Referer': 'http://www.xtremetop100.com/in.php?site=1132347673',
        'DNT': '1',
        'Connection': 'close',
        'Upgrade-Insecure-Requests':'1',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': '440',
        })
        Proxy = {'http': 'http://' + random.choice(proxy)} # removed https because its useless for your website
        print("proxy = "+str(Proxy)[17:-2]) #[17:2] is to remove the first 17 char and the last 2 to just have the proxy address without https:// etc
        data = {
            'site' :"1132347673",
            'secure_captcha_check':random.randint(1000,9999), #I put a random because it never the same number
            'g-recaptcha-response':"Lol there is a captcha are u serious", #Yeah your vote will be useless now unless there are just using captcha to discourage going further without actually using it 
            'ticki' :"Vote+for+ZeroConquer[New+Server]"
               }
        r = requests.get("http://www.xtremetop100.com/in.php?site=1132347673") #to get cookies
        print(requests.utils.dict_from_cookiejar(r.cookies)) #to show the cooies
        re = s.post(url,data=data, cookies=requests.utils.dict_from_cookiejar(r.cookies), proxies=Proxy) #GO BOI
        print(r.status_code)
        print(r.reason)
        sleep(1)
    except Exception as e:
        print(e)
        sleep(1) #Sleep to avoid a infinitly spam in the terminal if something goes wrong because its a loop
        pass

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

来自分类Dev

如何将消息从纯数据发送到Python?

来自分类Dev

如何将数据从Python发送到Android App

来自分类Dev

如何将数据窗口表单应用程序发送到网站

来自分类Dev

如何将jsdoc参数发送到Web请求?

来自分类Dev

如何将发布请求发送到Rails Action

来自分类Dev

Laravel如何将请求发送到Elasticsearch节点?

来自分类Dev

如何将POST请求从Android发送到PHP

来自分类Dev

如何将数据从uitableviewcontroller发送到uitableviewcell

来自分类Dev

如何将WordPress循环数据发送到jQuery?

来自分类Dev

如何将数据参数发送到组件?

来自分类Dev

如何将数据发送到Markdown Laravel?

来自分类Dev

如何将数据发送到GoHTML模板

来自分类Java

如何将数据从表单发送到后端?[Java]

来自分类Dev

如何将数据发送到CloudFlare API?

来自分类Java

如何将数据从DialogFragment发送到Fragment?

来自分类Dev

如何将数据发送到如下所示的XMLHttpRequest?

来自分类Dev

如何将数据从活动发送到Java类

来自分类Dev

如何将Json数据从javaScript发送到Flask

来自分类Dev

如何将数据从烧瓶发送到HTML模板

来自分类Dev

如何将数据从路线发送到组件?

来自分类Dev

(android)如何将数据从DialogFragment发送到Activity?

来自分类Dev

如何将数据发送到控制器

来自分类Dev

如何将数据从React发送到Express

来自分类Dev

如何使用Python请求将图像发送到Strapi?

来自分类Dev

如何将数据从Python异步套接字服务器发送到子进程?

来自分类Dev

如何将数据发送到正在运行的python线程?

来自分类Android

如何将数据从Firebase发送到Android / iOS应用程序和Python

来自分类Dev

如何将数据从javascript发送到python flask后端?

来自分类Dev

如何将音频Blob从JavaScript发送到python?

TOP 榜单

热门标签

归档