本文整理汇总了Python中zoundry.base.zdom.dom.ZDom.selectSingleNodeText方法的典型用法代码示例。如果您正苦于以下问题:Python ZDom.selectSingleNodeText方法的具体用法?Python ZDom.selectSingleNodeText怎么用?Python ZDom.selectSingleNodeText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zoundry.base.zdom.dom.ZDom
的用法示例。
在下文中一共展示了ZDom.selectSingleNodeText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _uploadStream
# 需要导入模块: from zoundry.base.zdom.dom import ZDom [as 别名]
# 或者: from zoundry.base.zdom.dom.ZDom import selectSingleNodeText [as 别名]
def _uploadStream(self, fileName, fileStream, metaData): #@UnusedVariable
data = {
u"xml" : u"yes", #$NON-NLS-1$ #$NON-NLS-2$
u"fileupload" : fileStream #$NON-NLS-1$
}
code = self._getRegistrationCode()
if code:
data[u"cookie"] = code #$NON-NLS-1$
imageShackUrl = u"http://www.imageshack.us/index.php" #$NON-NLS-1$
request = ZSimpleTextHTTPRequest(imageShackUrl)
ok = request.send( data )
if ok:
respData = request.getResponse()
dom = ZDom()
dom.loadXML( respData )
url = dom.selectSingleNodeText(u"/links/image_link") #$NON-NLS-1$
return ZUploadResponse(url)
else:
code = unicode( request.getHttpStatusCode() )
msg = unicode( request.getHttpStatusMessage() )
raise ZException(u"ImageShackMedia upload failed. HTTP response: %s %s" % (code, msg)) #$NON-NLS-1$