I am creating a app using kivy. I have installed simple dhcp server on my android.
import urllib
from kivy.network.urlrequest import UrlRequest
def bug_posted(req, result):
print('Our bug is posted !')
print(result)
params = urllib.urlencode({'@number': 12524, '@type': 'issue',
'@action': 'show'})
headers = {'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'text/plain'}
req = UrlRequest('<ip>:<port>', on_success=bug_posted, req_body=params,
req_headers=headers)
print req
result = "test"
bug_posted(req, result)
But, when I run this code, it wont logged in my server. how can I log into my server?
Did you give the ”INTERNET” permission to your app? Did you check in the logs (a that the service was running? did you try with something else that the thread-based urlrequest (that is useful in gui to avoid blocking, but less in a service)?
(I still don't understand why you mention the dhcp server, your device still access the internet correctly, right?)
Try calling:
req.wait()
near the end of your code
import urllib
from kivy.network.urlrequest import UrlRequest
def bug_posted(req, result):
print('Our bug is posted !')
print(result)
params = urllib.urlencode({'@number': 12524, '@type': 'issue',
'@action': 'show'})
headers = {'Content-type': 'application/x-www-form-urlencoded',
'Accept': 'text/plain'}
req = UrlRequest('<ip>:<port>', on_success=bug_posted, req_body=params,
req_headers=headers)
req.wait()
without it the request does not seem to fire for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With