Commit 8c980d4c authored by Benjamin Graillot's avatar Benjamin Graillot

Ajout de la source github

parent 545c5172
import base64
import email
import email.header
import quopri
import re
import html2text
from imapidle import imaplib
import secrets
import source
def decode_header(header):
header_parts = email.header.decode_header(header)
header = ''
for part, encoding in header_parts:
if isinstance(part, str):
header += part
header += part.decode('ascii' if encoding is None else encoding, 'ignore')
return header
class Github(source.Source):
def __init__(self):
source.Source.__init__(self, 'github', '')
def parse_mail(self, mail):
sender = decode_header(mail['From'])
if self.address not in sender:
subject = decode_header(mail['Subject'])
m = re.match(r"^\[(?P<repository>[^]]*)\] (?P<release>.*)$", subject)
repo ='repository')
release ='release')
self.push_update(repo, "\x0310{repo}\x0F \x0303{name}\x0F".format(repo=repo, name=release))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment