Python Client Offline Record

Hi,
I’ve got a python application running on linux devices. They may or may not have internet at the time of a crash. They usually get internet connection at some point. So basically my scenario is record errors while offline and try to send them when devices online. I can record errors messages in database but sentry seems record another information like packages information etc. Is there any way to record errors while offline. What is the best approach for this scenario.

Thanks.

You should be able to split up the SDK into two objects: a transport and a client.

from sentry_sdk import *

my_queue = []

init(transport=my_queue.append)


# write my_queue to disk here (can be serialized to JSON)
# later in different process, read it again

from sentry_sdk.transport import make_transport

transport = make_transport({"dsn": ...})
for event in my_queue:
    transport.capture_event(event)

transport.flush()