我目前能夠更新使用python腳本我confluence維基頁面類似如下:從Excel宏更新我的wiki
import sys
from xmlrpclib import Server
s = Server("https://my.wiki.root/rpc/xmlrpc")
token = s.confluence2.login("user", "passwd")
page = s.confluence2.getPage(token, "WIKI SPACE", "page")
page["content"] = '<xml content>'
s.confluence2.storePage(token, page)
[credits to Atlassian's Confluence XML-RPC and SOAP APIs]
但我不能安裝Python(我不對於這種偉大的語言知之甚少),我想知道我是否可以(幾乎)使用Excel輕鬆完成。我想這樣的:
Sub updatePage()
Dim URL As String, myXML As String
Dim xmlHttp As Variant
Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
myXML = "<my xml>"
URL = "https://my.wiki.root/rpc/xmlrpc"
xmlHttp.Open "POST", URL, False
#' I specify my content type
xmlHttp.SetRequestHeader "Content-Type", "text/xml"
#' Here I'm less and less sure
xmlHttp.send "pageId=248091993&editorFormat=" + myXML
#' This is void...
MsgBox xmlHttp.responseText
End Sub
我剛剛得到什麼的responseText
。我不知道要去哪裏看。
- 如何「模擬」這些python命令(無需像pyxll那樣安裝怪異軟件)?如果我沒有vba解決方案,我會(很容易?)修復一些問題,以便通過putty將命令發送到可運行python的服務器......但我確信可以使用Excel來完成。
- 如果我知道如何才能得到這
s
結構返回python與Server("xmlrpc URL")
我會贏!但是它是什麼?我如何使用Excel獲取它?
在VBA代碼中,您不會嘗試登錄 - 是否可以在URL中發送登錄詳細信息。 'URL =「https://my.wiki.root/rpc/xmlrpc?id = user&pwd = passwd」? –