【python】 urllib.unquote()

来源:http://blog.csdn.net/anhuidelinger/article/details/10096727

urllib.unquote()

字符串被当作url提交时会被自动进行url编码处理,在python里也有个urllib.urlencode的方法,可以很方便的把字典形式的参数进行url编码。可是在分析httpheaders的传输信息时,很多已经被url编码的字符串,不是我们这些菜鸟一眼能看出来的,于是乎,urllib.unquote()

s = "url=%2F&email=imtesting%40tempmail.com&password=hereispassword"
print urllib.unquote(s)

>>> url=/&[email protected]&password=hereispassword

python很nice ^^

这就是所谓的“urlencode逆向”

时间: 2024-08-11 07:41:35

【python】 urllib.unquote()的相关文章

【Python】Python的urllib模块、urllib2模块进行网页下载文件

由于需要从某个网页上下载一些PDF文件,但是需要下载的PDF文件有几百个,所以不可能用人工点击来下载.正好Python有相关的模块,所以写了个程序来进行PDF文件的下载,顺便熟悉了Python的urllib模块和ulrllib2模块. 1.问题描述 需要从http://www.cvpapers.com/cvpr2014.html上下载几百个论文的PDF文件,该网页如下图所示: 2.问题解决 通过结合Python的urllib模块和urllib2模块来实现自动下载.代码如下: test.py #!

【python】获取51cto博客的文章列表

python的正则与网页操作练习二: import re import urllib.request #51cto urlcode=gb18030 class down51web: s_url='' s_blogid='' s_blogpages='' s_html='' s_code='' def __init__(self,url,code): self.s_url=url self.s_code=code def get_html(self): self.s_html=urllib.req

【python】urllib2

urllib2.urlopen(url[, data][, timeout]) Open the URL url, which can be either a string or a Request object. data may be a string specifying additional data to send to the server, or None if no such data is needed. Currently HTTP requests are the only

【python】自动登录51cto家园

自动登录:http://home.51cto.com 1.分析: 使用httpfox抓取手动登录home.51cto.com的过程,过程如下: 点登录,提交用户名与密码到http://home.51cto.com/index.php?s=/Index/doLogin 这个地址,正确后,他会返回的内容包含很多链接,如第二个图片.然后分别get这些链接.请求完这些链接后,再访问个人主页http://home.51cto.com/index.php?s=/Home/index post成功后服务器返回

【python】简单的网页内容获取 - 有道翻译英文

正则表达式与python的网页操作练习一: import urllib.request import re qname=input('input english:') qname=qname.strip() url='http://dict.youdao.com/search?le=eng&q='+qname+'&keyfrom=dict.top' html=urllib.request.urlopen(url) source=html.read().decode('UTF-8') reg

【Python】SyntaxError: Non-ASCII character '\xe8' in file

遇到的第一个问题: SyntaxError: Non-ASCII character '\xe8' in file D:/PyCharmProject/TempConvert.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 原因:注释里面出现了中文,而 Python 支持的 ASCII 码无中文. 解决方法:在头文件中添加如下代码: # -*- coding:

【python】禁止print输出换行的方法

print后用一个逗号结尾就可以禁止输出换行,例子如下 >>> i=0 >>> while i < 3: print i i+=1 0 1 2 禁止输出换行后效果如下: >>> i=0 >>> while i < 3: print i, i+=1 0 1 2 [python]禁止print输出换行的方法,布布扣,bubuko.com

【python】chr与ord函数的使用

ord()是将已知字母转换成其顺序值: chr()是将已知字母的顺序至转换成其对应的字母 >>> ord("a") 97 >>> ord("A") 65 >>> chr(97) 'a' >>> chr(65) 'A' [python]chr与ord函数的使用,布布扣,bubuko.com

【python】ipython与python的区别

[python]ipython与python的区别 (2014-06-05 12:27:40) 转载▼   分类: Python http://mba.shengwushibie.com/itbook/BookChapter.asp?id=8745 http://www.cnblogs.com/yangze/archive/2011/07/11/2103040.html http://matrix.42qu.com/10735149 http://www.cnblogs.com/weishun/