I m new here,Some time ago I worked with kivy now I have a problem with, here is my problem I must upload an images with description in the server, I use django as backend and I use kivy urlrequest, how can I do this, Thank you all
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/179c886d-fdd7-492e-80f3-422ebb1bfde8n%40googlegroups.com.
Thank you for your answer,
I'm sorry for my rude, I use kivy urlrequest because it is ansync, I post a piece of my code:
def creat_profile(self, *args):
username = self.screen.get_screen('login_screen').ids.username.text
mail = self.screen.get_screen('signin_screen').ids.mail.text
avatar = self.path
if email != '':
params = json.dumps({'username': username, 'email': mail})
headers = {'Content-type': 'multipart/form-data',
'Accept': 'application/json'}
req = UrlRequest('http://127.0.0.1:8000/user_profile', method='POST', on_success=self.profil_created, on_failure=self.profil_error, req_body=params,
req_headers=headers, ca_file=cfi.where(),verify=True, on_error=self.error, files = avatar)To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/9dc2e24a-6389-4ec7-a78e-cc1e05ab0e3an%40googlegroups.com.
UrlRequest('http://127.0.0.1:8000/user_profile', method='POST', on_success=self.profil_created, on_failure=self.profil_error, req_body=params, req_headers=headers, ca_file=cfi.where(), verify=True, on_error=self.error, files = avatar)
Just looking at this code, the files keyword is not in the documentation.
I don’t see where you are opening the file or passing the file handle in the call.
I would recommend searching the web for how the requests (the requests library) is used for posting an image, and modify that for UrlRequest.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAPwDc-QwCPn3FQjPVurc9kBWcfQC%2BCGWJ%2BgFsQE6%3DzXDQQHyZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2ca63de6-c523-4999-b670-45d545fff241n%40googlegroups.com.