Hi all. I try traslate this code in pyton:
i have in main this code:
and in my class busromaclass i have this code:
No errors, Sub Initialize work without problem but finish there.
He does not come in JobDone.
( In attachment source )
Any idea ?
Thank you all
Marco
B4X:
DEV_KEY = 'RwYtcwQz85DUpn6FPQCU7ImB2MBM8Dfl'
s1 = Server('http://muovi.roma.it/ws/xml/autenticazione/1')
s2 = Server('http://muovi.roma.it/ws/xml/paline/7')
token = s1.autenticazione.Accedi(DEV_KEY, '')
res = s2.paline.Previsioni(token, '70101', 'it')
pprint(res)
i have in main this code:
B4X:
Dim bus As busromaclass
bus.Initialize("RwYtcwQz85DUpn6FPQCU7ImB2MBM8Dfl")
and in my class busromaclass i have this code:
B4X:
Public Sub Initialize(password As String)
Dim job1 As HttpJob
job1.Initialize("MyJob", Me)
job1.Download("http://muovi.roma.it/ws/xml/autenticazione/1")
job1.GetRequest.SetHeader("autenticazione.Accedi", Array As String(password, ""))
job1.GetRequest.SetHeader("Content-Type", "application/json")
job1.GetRequest.SetContentEncoding("text/plain")
End Sub
Private Sub JobDone(job As HttpJob)
If job.Success Then
Dim res As String
res = job.GetString
Log("Response from server: " & res)
Else
ToastMessageShow("Error: " & job.ErrorMessage, True)
End If
job.Release
End Sub
No errors, Sub Initialize work without problem but finish there.
He does not come in JobDone.
( In attachment source )
Any idea ?
Thank you all
Marco
Attachments
Last edited: