Issues using an api from a script which will be ran by the particle cloud


I am using the particle cloud service in combination with a raspberry pi 3b+. I have recognized a strange behavior which I don’t understand.

Let me give some context:
I am starting a process (run a python script) if a wlan_disconnect event happens and killing that process if a wlan_connect event appears. The script itself activates the camera on the raspberry pi and will create images if motion get’s detected. That works fine.

I have added the dropbox api to that script, which will upload the images which are created.

The issue is, it works fine if I start the script from the pi, but the dropbox upload does not work if I let particle cloud start the script, but the image creation will work. I tried to read the stdout from the started process to understand what’s going on, but I didn’t manage to get this running. Any recommendations, why the dropbox-api runs if I run the process on the pi but not from the particle cloud?
Thank you very much.