コード例 #1
0
    def sendSuccessEmail(self, filename, metadata):
        email = metadata.get('user','')
        comments = self.markdown.convert(metadata.get('comments',''))
        if not email:
            logging.warning("error, no email stored %r %r" % (filename, metadata))
            return
        nickname = email.split('@')[0]
        if email == "*****@*****.**":
            email = "*****@*****.**"
        if metadata.get('gtfs_crawler','f') == 't':
            email = "*****@*****.**"
            
        text = """
Thank you for your participation in sharing 
transit schedule data with others. Open access
to data fosters inovation, and promotes transit
usage.        
        
The file you uploaded is now 
archived on GTFS Data Exchange as    
%(filename)s.

%(comments)s

You can view this file along with your comments at    
<http://www.gtfs-data-exchange.com/user/%(nickname)s/>
""" % {'filename':filename,'nickname':nickname,'comments':comments}
        EmailUtils.sendEmail(email,'GTFS Upload Successful',text)
        if email != "*****@*****.**":
            EmailUtils.sendEmail('*****@*****.**','GTFS File Uploaded','%(filename)s was uploaded by %(nickname)s' % {'filename':filename,'nickname':nickname,'comments':comments})
コード例 #2
0
ファイル: app.py プロジェクト: chriswongtv/peterslist
def handleBrokerNotification():
	notificationJsonString = list(request.form.to_dict().keys())[0]
	notificationDict = json.loads(notificationJsonString)
	channelName = notificationDict["channelName"]
	channelResultSet = channelName + "Results"
	subId = notificationDict["subscriptionIds"][0]
	# Get results using the subscription id
	subIdResults = json.loads(SubscriptionUtils.getResultUsingSubId(channelResultSet, subId))["results"]
	userId = SubscriptionUtils.getUserIdUsingSubId(subId)

	# Send Email
	emailBody = EmailUtils.generateEmailHtmlStrFromResults(subIdResults, subId, channelName)
	print(emailBody)
	EmailUtils.sendEmail(emailBody, userId)

	# Delete all the results
	SubscriptionUtils.deleteResultUsingSubId(channelResultSet, subId)
	return "Success"
コード例 #3
0
    def sendSuccessEmail(self, filename, metadata):
        email = metadata.get('user', '')
        comments = self.markdown.convert(metadata.get('comments', ''))
        if not email:
            logging.warning("error, no email stored %r %r" %
                            (filename, metadata))
            return
        nickname = email.split('@')[0]
        if email == "*****@*****.**":
            email = "*****@*****.**"
        if metadata.get('gtfs_crawler', 'f') == 't':
            email = "*****@*****.**"

        text = """
Thank you for your participation in sharing 
transit schedule data with others. Open access
to data fosters inovation, and promotes transit
usage.        
        
The file you uploaded is now 
archived on GTFS Data Exchange as    
%(filename)s.

%(comments)s

You can view this file along with your comments at    
<http://www.gtfs-data-exchange.com/user/%(nickname)s/>
""" % {
            'filename': filename,
            'nickname': nickname,
            'comments': comments
        }
        EmailUtils.sendEmail(email, 'GTFS Upload Successful', text)
        if email != "*****@*****.**":
            EmailUtils.sendEmail(
                '*****@*****.**', 'GTFS File Uploaded',
                '%(filename)s was uploaded by %(nickname)s' % {
                    'filename': filename,
                    'nickname': nickname,
                    'comments': comments
                })
コード例 #4
0
    def send_error_email(self, key, msg):
        if tornado.options.options.shunt_s3:
            metadata = json.loads(open("/tmp/gtfs_s3/queue/" + key + ".meta", "rb").read())
        else:
            metadata = self.conn.head(self.bucket, key).object.metadata
        email = metadata.get('user','')
        if not email:
            logging.info('no email stored for key %r error %r' % (key, msg))
            return
        if metadata.get('gtfs_crawler','f') == 't':
            email = "*****@*****.**"
            msg += '\n' + str(metadata)
        
        text = """The following error was encountered while processing your GTFS upload.

%s

Please correct the error and re-try this upload.    
<http://www.gtfs-data-exchange.com/upload>    
""" % msg
        EmailUtils.sendEmail(email,'GTFS Upload Error',text)
コード例 #5
0
    def send_error_email(self, key, msg):
        if tornado.options.options.shunt_s3:
            metadata = json.loads(
                open("/tmp/gtfs_s3/queue/" + key + ".meta", "rb").read())
        else:
            metadata = self.conn.head(self.bucket, key).object.metadata
        email = metadata.get('user', '')
        if not email:
            logging.info('no email stored for key %r error %r' % (key, msg))
            return
        if metadata.get('gtfs_crawler', 'f') == 't':
            email = "*****@*****.**"
            msg += '\n' + str(metadata)

        text = """The following error was encountered while processing your GTFS upload.

%s

Please correct the error and re-try this upload.    
<http://www.gtfs-data-exchange.com/upload>    
""" % msg
        EmailUtils.sendEmail(email, 'GTFS Upload Error', text)