博客
关于我
爬虫快速入门——发送post请问
阅读量:331 次
发布时间:2019-03-04

本文共 732 字,大约阅读时间需要 2 分钟。

直接上代码,解释在注释,不懂评论留言,必回

#项目名称:#项目简介:#作   者:key#开发时间:2020/10/28 19:10from urllib.request import Request, urlopenfrom urllib.parse import urlencodefrom fake_useragent import UserAgent# 笔者已经测试过了,post请求武汉学院的教务系统url = 'http://59.172.226.5/eams/login.action'form_data ={       'user': "",  # 输入你的学号    'password': ''  # 输入你的密码}headers = {       'User-Agent': UserAgent().chrome,    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,"              "application/signed-exchange;v=b3;q=0.9 ",    "Content-Type": "application/x-www-form-urlencoded"}f_data = urlencode(form_data)request = Request(url, headers=headers, data=f_data.encode())response = urlopen(request)print(response.read().decode())

转载地址:http://aith.baihongyu.com/

你可能感兴趣的文章
nginx学习笔记002---Nginx代理配置_案例1_实现了对前端代码的方向代理_并且配置了后端api接口的访问地址
查看>>
Nginx安装SSL模块 nginx: the “ssl” parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx
查看>>
Nginx安装与常见命令
查看>>
Nginx安装及配置详解
查看>>
nginx安装配置
查看>>
Nginx实战经验分享:从小白到专家的成长历程!
查看>>
Nginx实现反向代理负载均衡
查看>>
nginx实现负载均衡
查看>>
nginx常用命令及简单配置
查看>>
Nginx常用屏蔽规则,让网站更安全
查看>>
nginx开机启动脚本
查看>>
nginx异常:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf
查看>>
nginx总结及使用Docker创建nginx教程
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:128
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in usrlocalnginxconfnginx.conf128
查看>>
nginx日志分割并定期删除
查看>>
Nginx日志分析系统---ElasticStack(ELK)工作笔记001
查看>>
Nginx映射本地json文件,配置解决浏览器跨域问题,提供前端get请求模拟数据
查看>>
nginx最最最详细教程来了
查看>>
Nginx服务器---正向代理
查看>>