What I want is to have a macro that will do this request and return the value into a cell. Also some aditional information for possible parameters when trying to do post. I might want to keep it portable so an OOoBasic would be fine.
regards.
Last edited by jza on Sun Dec 27, 2015 6:40 am, edited 2 times in total.
Sorry I should mention that I wanted this for Basic, not Python. I want to make this portable without the next user to have to run the system python (windows users). The AOO python also doesnt include requests and many end users will be intimidated asking them, oh btw you need to manually install requests on your AOO python-path.
Function getWebService(request As String) As String
Dim sfa As Object, flux As Object, repDoc As Object
Dim repXml As String
sfa = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
repDoc = CreateUnoService("com.sun.star.io.TextInputStream")
repXml = ""
On Error GoTo badRequest
flux = sfa.openFileRead(request)
repDoc.InputStream = flux
Do while not repDoc.isEOF
repXml = repXml & " " & repDoc.readLine
Loop
flux.closeInput
repDoc.closeInput
finished:
getWebService = repXml
Exit Function
badRequest:
Resume finished
End Function
Usage (if the answer does not need further analysis):