forked from t-jayw/pleasetakecareofmyplant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
39 lines (29 loc) · 851 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
from getpass import getuser
import requests
import praw
from secret import user_agent, password, weather_api, zipcode, test_sub
# PRAW
user_name = 'takecareofmyplant'
subreddit = 'takecareofmyplant'
def getReddit():
r = praw.Reddit(user_agent=user_agent)
r.login(user_name, password)
return r
def getSubReddit(Reddit, test=False):
sub = test_sub if test else subreddit
sr = Reddit.get_subreddit(sub)
return sr
# Files
def pathPrefix():
pi = '/home/pi/pleasetakecareofmyplant/'
tyler = '/Users/tyler_wood/personal/pleasetakecareofmyplant/'
user = getuser()
path = tyler if user == 'tyler_wood' else pi
return path
# Kill Switch
def checkKillSwitch():
url = "http://www.pleasetakecareofmyplant.com/killswitch.html"
r = requests.get(url)
check = int(r.content)
return check