# Set-up r = c.getReddit() sr = c.getSubReddit(r) post_body = posts.body post_title = posts.title if c.checkKillSwitch() == 1: sys.exit() # Post Thread s = sr.submit(post_title, text=post_body) s.sticky() # Logging path_prefix = c.pathPrefix() with open(path_prefix+'daily_thread.txt', 'w') as f: f.write(s.id) f.close() with open(path_prefix+'topup.txt', 'r+') as f: x = f.read() if x == '1': g.on_off(10) # Reset continuous comment files with open(path_prefix+'/continuous_tally/cont_comment_log.txt', 'w') as f: f.write('') f.close()
import requests import os import sys sys.path.append("/home/pi/pleasetakecareofmyplant/") import config as c from secret import plant_cam_device_id, nest_api_auth from post_templates import now_pst path = c.pathPrefix() url = "https://www.dropcam.com/api/wwn.get_snapshot/%s?auth=%s"%(plant_cam_device_id, nest_api_auth) r = requests.get(url) img = r.content print now_pst file_name = str(now_pst) +"_screengrab.jpg" with open(path+"time_lapse/captures/"+file_name, 'w') as f: f.write(img) f.close()
# Set-up r = c.getReddit() sr = c.getSubReddit(r) post_body = posts.body post_title = posts.title if c.checkKillSwitch() == 1: sys.exit() # Post Thread s = sr.submit(post_title, text=post_body) s.sticky() # Logging path_prefix = c.pathPrefix() with open(path_prefix + 'daily_thread.txt', 'w') as f: f.write(s.id) f.close() with open(path_prefix + 'topup.txt', 'r+') as f: x = f.read() if x == '1': g.on_off(10) # Reset continuous comment files with open(path_prefix + '/continuous_tally/cont_comment_log.txt', 'w') as f: f.write('') f.close()