taboca / challenges-python Goto Github PK
View Code? Open in Web Editor NEWOpen bugs and challenges related to a private repository
Open bugs and challenges related to a private repository
Transient article ecossystem
We have
slides-live.js (working with tv3)
slides-live-fullpage.js (working with fullpage)
This is seed to an architecture so that we can replace the supervisor animation player and/or have multiple of them working.
class handlingAnonymousIncomingEmail(InboundMailHandler):
def receive(self, mail_message):
logging.info("Received a mail_message from: " + mail_message.sender)
logging.info("The email subject: " + mail_message.subject)
logging.info("The email was addressed to: " + unicode.join(mail_message.to, ', '))
try:
logging.info("The email was CC-ed to: " + unicode.join(mail_message.cc, ', '))
except exceptions.AttributeError :
logging.info("The email has no CC-ed recipients")
try:
logging.info("The email was send on: " + unicode(mail_message.date))
except exceptions.AttributeError :
logging.info("The email has no send date specified!!!")
plaintext_bodies = mail_message.bodies('text/plain')
html_bodies = mail_message.bodies('text/html')
title = mail_message.subject.strip()
for content_type, body in html_bodies:
decoded_html = body.decode()
logging.info("content_type: " + content_type)
logging.info("decoded_html: " + decoded_html)
plaintext_bodies
bodyStr = unicode("")
for b in mail_message.bodies("text/plain"):
body_type, pl = b
try:
if pl.encoding:
body = pl.payload.decode(pl.payload.encoding)
else:
body = pl.payload
logging.info(u"---->" + body)
bodyStr = bodyStr + unicode(body)
except Exception, e:
logging.debug("Body: %s" % (pl))
bodyStr = bodyStr + unicode(pl)
logging.info(u"***" + bodyStr)
transientUniqueId = transient.fromEmail_transientPresentation_new(mail_message.sender, bodyStr)
# future...
#transientUniqueId = fromEmail_transientPresentation_new(mail_message.sender, bodyStr, attachments)
logging.info('transientPresentation UniqueID response: ' + transientUniqueId)
logging.info("-- e-mail received --")
calls
def aSync_transientPresentation_process(anonymousEmail, anonymousBody):
logging.info('cron :: transient -> ')
# Splitting markdown
strHTML = mDown(anonymousBody)
# https://docs.python.org/2/library/xml.dom.minidom.html
domDoc = parseString('<root>'+strHTML+'</root>')
slides = domDoc.getElementsByTagName("section")
logging.info('cron :: transient -> mdown :' + anonymousBody)
logging.info('cron :: transient -> html :' + strHTML)
for slide in slides:
serializedNode = slide.toprettyxml(indent = "", newl='\n', encoding = 'utf-8')
logging.info("SerializedSection:" + serializedNode)
# title = slide.getElementsByTagName("h1")[0]
# print "<p>%s</p>" % getText(title.childNodes)
h = html2text.HTML2Text()
h.ignore_links = False
sectionInMarkdown = h.handle('\n'+serializedNode)
logging.info("Back to markdown:" + sectionInMarkdown)
bodyStr = '\n\n'+sectionInMarkdown
logging.info("To formdata:" + bodyStr)
This works if e-mail content has sectionized (#,##,##,..) markdown structures. When the e-mail has just plain content, what we have strHTML = mDown(anonymousBody)
is a e-mail header info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.