Http Basic Authorizaition验证
来源:互联网 发布:java 短信防刷 编辑:程序博客网 时间:2024/05/23 14:17
Http Basic Authorizaition验证的原理详见
http://zh.wikipedia.org/wiki/HTTP%E5%9F%BA%E6%9C%AC%E8%AE%A4%E8%AF%81
python实现:
import urllib2
import sys
import re
import base64
from urlparse import urlparse
theurl = 'http://api.minicloud.com.cn/statuses/friends_timeline.xml'
username = 'qleelulu'
password = 'XXXXXX' # 你信这是密码吗?
base64string = base64.encodestring(
'%s:%s' % (username, password))[:-1] #注意哦,这里最后会自动添加一个\n
authheader = "Basic %s" % base64string
req.add_header("Authorization", authheader)
try:
handle = urllib2.urlopen(req)
except IOError, e:
# here we shouldn't fail if the username/password is right
print "It looks like the username or password is wrong."
sys.exit(1)
thepage = handle.read()
原理就是添加了请求头Authorization
http://zh.wikipedia.org/wiki/HTTP%E5%9F%BA%E6%9C%AC%E8%AE%A4%E8%AF%81
python实现:
import urllib2
import sys
import re
import base64
from urlparse import urlparse
theurl = 'http://api.minicloud.com.cn/statuses/friends_timeline.xml'
username = 'qleelulu'
password = 'XXXXXX' # 你信这是密码吗?
base64string = base64.encodestring(
'%s:%s' % (username, password))[:-1] #注意哦,这里最后会自动添加一个\n
authheader = "Basic %s" % base64string
req.add_header("Authorization", authheader)
try:
handle = urllib2.urlopen(req)
except IOError, e:
# here we shouldn't fail if the username/password is right
print "It looks like the username or password is wrong."
sys.exit(1)
thepage = handle.read()
原理就是添加了请求头Authorization
0 0
- Http Basic Authorizaition验证
- HTTP Basic Authentication验证WCF Data Service
- Java中,使用HTTP Basic进行验证
- 使用HttpClient进行HTTP BASIC验证
- http协议接口调用,basic验证
- 【HTTP】http 401Basic验证和WWW-Authenticate、Authorization
- Spring Http Basic(基本)和Digest(摘要)验证
- HTTP验证大法(Basic Auth,Session, JWT, Oauth, Openid)
- spring 4 restful 服务添加http-basic 验证。
- HTTP 验证 Tomcat中进行基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)
- HTTP 验证 Tomcat中进行基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)
- Tomcat 中的 BASIC验证
- tomcat basic验证
- C#、asp.net访问基于http basic验证的api原理
- C#、asp.net访问基于http basic验证的api原理
- C#如何调用axis发布的带HTTP Basic Authentication验证的接口配置方式
- Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结Atitit HT
- Implement basic HTTP authentication
- 园艺花卉产品采购推荐管理系统开发 已买产品管理检查查询工具
- 我的位置
- 登录验证的三种方式(控制台)
- STM32F103停机模式测试
- Linux对MySQL优化(从操作角度)
- Http Basic Authorizaition验证
- Objective-C iOS开发中常见的语句@synthesize obj=_obj的意义详解
- ajax
- 对话框程序菜单项可以禁用但不变灰问题的解决方法
- java中,如何安全的结束一个正在运行的线程?
- 枚举和字符串互转
- Hello !
- Linux下MySQL常用操作网络汇总总结
- 【servlet】servlet 笔记