I have a little functionality here where i'm pulling information from a 
web2py server and displaying it on a kivy app for the user, all the other 
details are displaying but the image is failing to display & I get the 
error:* [ERROR  ] [AsyncImage  ] Not found 
<person.image.9c6d5fece48d877e.SU1HLTIwMjIwOTE2LVdBMDAwMC5qcGc=.jpg>.*

What am I doing wrong? How do I get the image to display coz its clearly 
there?

*WEB2PY CODE:*
@request.restful()
def api_list_clients():
    def GET(*args, **vars):
        query = db().select(db.person.ALL)
        return response.json(dict(clients=query.as_list()))
    return locals()

*KIVY CODE:*
def read_from_server(self):
        self.root.ids.display_screen.clear_widgets()
        response = requests.get("
http://localhost:8000/clients/default/api_list_clients";)
        if response.status_code == 200:
            print("Response content:", response.content)
            try:
                data = response.json()
                clients = data.get("clients", [])
                for client in clients:
                    name = client.get("name")
                    surname = client.get("surname")
                    cell = client.get("cell")
                    email = client.get("email")
*                    image_url = client.get("image")  *
                    details_layout = BoxLayout(orientation='vertical', 
spacing=10)
                    name = MDLabel(text=name, halign="center")
                    surname=MDLabel(text=surname, halign='center')
                    cell=MDLabel(text=cell, halign='center')
                    email=MDLabel(text=email, halign='center')
                    details_layout.add_widget(name)
                    details_layout.add_widget(surname)
                    details_layout.add_widget(cell)
                    details_layout.add_widget(email)
*                    image = AsyncImage(source=image_url)*
*                    details_layout.add_widget(image)*
                    self.root.ids.display_screen.add_widget(details_layout)
            except json.JSONDecodeError as e:
                print("Error parsing JSON response:", e)
        elif response.status_code == 204:
            # Handle empty response (No Content)
            print("No clients found.")
        else:
            print("Failed to read from server. Status code:", 
response.status_code)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7f66b3bf-56ce-46fe-8567-691bf0655ee6n%40googlegroups.com.

Reply via email to