You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I built an android sample todo app using flet build apk, see also the full codes in the Code sample section. The App just takes an input from the users and save it in Detabase in Deta space cloud.
This setup worked in windows 10 without issues.
I have three files namely: .env, requirements.txt and main.py.
In my android device Samsung Galaxy A14 with latest update installed, I got this error message:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
This is triggered in the following code, when I try to fetch entries in the Detabase, and is captured by the SnackBar.
def build_table_cells(db):
"""Gets entries from detabase."""
try:
response = db.fetch()
except Exception as err:
page.snack_bar = ft.SnackBar(
content=ft.Text(f'error message: {err}'),
action="Alright!",
duration=10000,
)
page.snack_bar.open = True
page.update()
else:
return [ft.DataRow(cells=[ft.DataCell(ft.Text(v['task']))]) for v in response.items]
return []
Does this issue related to my device, or deta space or from the flet's built apk?
Code sample
.env
DATA_KEY='XXXXXXXX'
requirements.txt
flet
deta
python-dotenv
main.py
import os
import flet as ft
from deta import Deta
from dotenv import load_dotenv
load_dotenv()
def main(page: ft.Page):
# Initialize deta
deta = Deta(os.getenv('DATA_KEY'))
db = deta.Base("todo_db")
def get_data_key(e):
"""Show data key."""
page.snack_bar = ft.SnackBar(
content=ft.Text(os.getenv('DATA_KEY')),
action="Alright!",
duration=5000,
)
page.snack_bar.open = True
page.update()
def add_task(e):
"""Adds task from user input."""
page.add(ft.Checkbox(label=new_task.value))
# Update detabase and table.
try:
db.put({"task": new_task.value})
except Exception as err:
page.snack_bar = ft.SnackBar(
content=ft.Text(f'error message: {err}'),
action="Alright!",
duration=10000,
)
page.snack_bar.open = True
page.update()
else:
dcell = build_table_cells(db)
table.rows = dcell
new_task.value = ""
page.update()
def build_table_cells(db):
"""Gets entries from detabase."""
try:
response = db.fetch()
except Exception as err:
page.snack_bar = ft.SnackBar(
content=ft.Text(f'error message: {err}'),
action="Alright!",
duration=10000,
)
page.snack_bar.open = True
page.update()
else:
return [ft.DataRow(cells=[ft.DataCell(ft.Text(v['task']))]) for v in response.items]
return []
# Init table.
table = ft.DataTable(
columns=[
ft.DataColumn(ft.Text("Task")),
]
)
# Add data cells in table from detabase.
dcell = build_table_cells(db)
table.rows = dcell
new_task = ft.TextField(hint_text="Whats needs to be done?")
# Build the UI
page.add(
ft.Column(
controls=[
ft.ElevatedButton("Query Deta Key", on_click=get_data_key),
ft.Row(
controls=[
new_task,
ft.FloatingActionButton(icon=ft.icons.ADD, on_click=add_task)
]
),
ft.Text('Task List', weight=ft.FontWeight.BOLD), # table header
ft.Column(
controls=[
table
],
scroll=ft.ScrollMode.ADAPTIVE,
height=200
)
]
)
)
ft.app(target=main)
### Error message
```bash
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
Discussed in #2312
Originally posted by fsmosca January 4, 2024
Question
I built an android sample todo app using
flet build apk
, see also the full codes in the Code sample section. The App just takes an input from the users and save it in Detabase in Deta space cloud.This setup worked in windows 10 without issues.
I have three files namely: .env, requirements.txt and main.py.
In my android device Samsung Galaxy A14 with latest update installed, I got this error message:
This is triggered in the following code, when I try to fetch entries in the Detabase, and is captured by the SnackBar.
Does this issue related to my device, or deta space or from the flet's built apk?
Code sample
.env
requirements.txt
main.py
------------------------------------------------------
The text was updated successfully, but these errors were encountered: