Repository navigation
Expand file tree
/
Copy pathSurveyMonkey.py
More file actions
38 lines (34 loc) · 1.4 KB
/
Copy pathSurveyMonkey.py
File metadata and controls
38 lines (34 loc) · 1.4 KB
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
37
38
import pandas as pd
import os, sys, shlex, subprocess, gam, datetime, json, smtplib, logging
from sqlalchemy.engine import URL
from sqlalchemy import create_engine
from pathlib import Path
from timeit import default_timer as timer
from email.message import EmailMessage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from logging.handlers import SysLogHandler
import surveymonkey_python
def main():
start_of_timer = timer()
confighome = Path.home() / ".Acalanes" / "Acalanes.json"
with open(confighome) as f:
configs = json.load(f)
thelogger = logging.getLogger('MyLogger')
thelogger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address = (configs['logserveraddress'],514))
thelogger.addHandler(handler)
#prep status (msg) email
msg = EmailMessage()
msg['From'] = configs['SMTPAddressFrom']
msg['To'] = configs['SendInfoEmailAddr']
msgbody = ''
WasThereAnError = False
DontDeleteFiles = False
# Change directory to a TEMP Directory where GAM and Python can process CSV files
os.chdir('E:\\PythonTemp')
ClientID = configs["SurveyMonkeyClientID"]
Secret = configs["SurveyMonkeySecret"]
AccessToken = configs["SurveyMonkeyAccessToken"]
client=Client(client_id=ClientID, client_secret=Secret, redirect_uri=REDIRECT_URI, access_token=AccessToken)