import urllib2 import cookielib import logging from ep import EP from opp import OP import sys sys.path.append("../") from gis_token_generator import GIS from get_response import GetResponse #CONFIG VARS start #CONFIG VARS start #the get reponbse instace for us to work gr = GetResponse() token_genrator = GIS() expa_token = token_genrator.generate_token(config.user_mail, config.user_pass) yop_token = token_genrator.generate_op_token(config.user_mail, config.user_pass) #print #CONFIG VARS end #CONFIG VARS end #this method gets the opps of gt oppened in the last week and sends them to GR for the #apropiate profiles ## this is supposed to be run once a week to then notify Get reposnse def notify_new_opps(expa_token): #map one opp per porgram
from gis_token_generator import GIS gis = GIS() print gis.generate_token('*****@*****.**', 'si no leo me aburro')
def __init__(self,user_mail,user_pass): self.url = 'https://gis-api.aiesec.org/v2/' token_genrator = GIS() self.expa_token = token_genrator.generate_token(user_mail, user_pass)
import smtplib from smtplib import SMTPException from smtplib import SMTP from email.mime.text import MIMEText from email.MIMEImage import MIMEImage import requests #import progressbar import sys reload(sys) sys.setdefaultencoding('utf8') ##CONSTANTS #to init we just get the acces token from expa with MC permissions token_genrator = GIS() token = token_genrator.generate_token(config.EXPA_USER, config.EXPA_PASS) mail_html = open('mail.html', 'r').read() yesterday = datetime.date.today() - datetime.timedelta(2) headers = { 'access_token': token, 'filters[created_at][from]': yesterday.strftime('%y-%m-%d'), 'filters[created_at][to]': yesterday.strftime('%y-%m-%d'), 'page': 1, 'filters[status]': 'open' } sender = config.MAIL_USER #this method will send a notificaciton fot he opp managers and ep managers def appNotificacion(page=1):