Turn on less secure apps at:

To do it so go to:
Create a new project:












/home/piRename the file to
client_secrets.json:cd ~
mv client_secret*json client_secrets.json
Download python upload code and config file:wget https://github.com/jerbly/motion-uploader/raw/04de61ce2c379955acac6a2bee676159882d9a86/uploader.py -O uploader.py
wget https://github.com/jerbly/motion-uploader/raw/04de61ce2c379955acac6a2bee676159882d9a86/uploader.cfg -O uploader.cfg
Here is copy of:
Set python script executable:chmod +x uploader.py
Set username and pasword into config file. Replace red:sed -i "s/gmailusername/myusername/" uploader.cfg
sed -i "s/gmailpassword/mypassword/" uploader.cfg
Set upload folder to test and turn off email messages:sed -i "s/folder = motion/folder = test/" uploader.cfg
sed -i "s/send-email = true/send-email = no/" uploader.cfg
Please create "test" directory into your google drive!If you miss this step nothing will work!
Create new sample file to upload:
echo Hello, Google Drive > hello.drive.log
Test the upload:./uploader.py uploader.cfg hello.drive.log
If you get something like this:Traceback (most recent call last):
File "./uploader.py", line 21, in <module>
import httplib2
ImportError: No module named httplib2
Install python pip package:sudo apt-get install python-pip -y
Use pip to install google-api-python-client:sudo pip install --upgrade google-api-python-client
Run again:./uploader.py uploader.cfg hello.drive.log
You will receive something like this:Go to this link in your browser:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%tent.com&access_type=offline
Enter the auth code:
Now you go to the link:

/home/pi/uploader_credentials.txtAs long as this file are there you will no longer will be asked to enter code!
No comments:
Post a Comment