create a picture with picamera and upload it to nextcloud [raspberrypi]

based on:

setup your cameramodule:

install picamera and nextcloudclient:
sudo apt install python-picamera python-pip -y
sudo pip install --upgrade pip
sudo pip install pyocclient

create a python script to create pic and upload it to nextcloud:

#change the following lines to use the script:
#line 12 to your nextcloud domain
#line 13 to your username and password
#line 17 to your password to be able to download the file from public

import owncloud
import time
import picamera

camera = picamera.PiCamera()
oc = owncloud.Client('http://domain.tld/owncloud')
oc.login('user', 'password')
dt = str(time.strftime("%Y-%m-%d--%H-%M-%S"))
newname = 'pic_'+dt+'.jpg'
oc.put_file('Photos/'+newname, 'picture.jpg')
link_info = oc.share_file_with_link('Photos/'+newname, password="MyPasswordForThePublicFile")
print "Here is your link: "+ link_info.get_link()

to run the python script:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.