<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>可可熊的窝 &#187; getsong</title>
	<atom:link href="http://cocobear.info/blog/tag/getsong/feed/" rel="self" type="application/rss+xml" />
	<link>http://cocobear.info/blog</link>
	<description>K.I.S.S</description>
	<lastBuildDate>Sat, 10 Dec 2011 16:11:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>更新PyFetion &amp;&amp; getsong</title>
		<link>http://cocobear.info/blog/2009/03/24/upgrade-pyfetion-and-getsong/</link>
		<comments>http://cocobear.info/blog/2009/03/24/upgrade-pyfetion-and-getsong/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 15:16:19 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[getsong]]></category>
		<category><![CDATA[PyFetion]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=585</guid>
		<description><![CDATA[给PyFetion加入了HTTP代理的支持，HTTP发送方式中。TCP发送方式也可能会加上吧，使用SocksiPy这个库吧，有时间再说。 改PyFetion的时候发现urllib2的一个问题： 先看下面这段代码： import urllib2 headers = [(&#34;Content-Type&#34;,&#34;application/oct-stream&#34;),] opener = urllib2.build_opener() opener.addheaders = headers urllib2.install_opener(opener) print &#34;after install_opener&#34; ret = opener.open('http://www.dict.cn',data=&#34;word=ss&#34;) print ret.read() 抓包发现发送的内容为： POST / HTTP/1.1 Accept-Encoding: identity Content-Length: 7 Host: www.dict.cn Content-Type: application/x-www-form-urlencoded Connection: close word=ss 这里我在代码里已经指定了HTTP的header: Content-Type，但是发出去的时候却被改变了。 通过分析urllib2的代码，找到： if request.has_data(): # POST data = request.get_data() if not request.has_header('Content-type'): request.add_unredirected_header( 'Content-type', 'application/x-www-form-urlencoded') if [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/03/24/upgrade-pyfetion-and-getsong/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

