37,741
社区成员
发帖
与我相关
我的任务
分享def getTopicsOfUser(loginUserName, password):
format = '''<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetTopicsOfUser xmlns="http://www.csdn.net/">
<identity>
<username>%s</username>
<password>%s</password>
</identity>
<listType>TopicOfUser</listType>
<forumId>a3049f56-b572-48f5-89be-4797b70d71cd</forumId>
</GetTopicsOfUser>
</soap12:Body>
</soap12:Envelope>'''
contentText = format % (loginUserName, password)
conn = httplib.HTTPConnection("forum.csdn.net")
headers = { "Connection":"close",
"Content-Type": "text/xml; charset=utf-8",
"SOAPAction": "http://www.csdn.net/GetTopicsOfUser"}
headers["Content-Length"] = "%d" % len(contentText)
conn.request("POST",
"/OpenApi/forumapi.asmx",
contentText,
headers)
r1 = conn.getresponse()import httplib
from xml.dom import minidom
import urllib
from urlparse import urlparse