예제 #1
0
    def test_create_ok_simple(self):
        tempfile = get_temp_file(self)
        _create(tempfile, ['foo=57'])

        # check
        saved = load(tempfile)
        self.assertEqual(saved, {'foo': '57'})
예제 #2
0
    def test_create_weird_equals(self):
        tempfile = get_temp_file(self)
        _create(tempfile, ['foo=', '=bleh', 'a=b=c'])

        # check
        saved = load(tempfile)
        self.assertEqual(saved, {'foo': '', '': 'bleh', 'a': 'b=c'})
예제 #3
0
    def test_create_ok_several(self):
        tempfile = get_temp_file(self)
        _create(tempfile, ['foo=57', 'bar=bleh'])

        # check
        saved = load(tempfile)
        self.assertEqual(saved, {'foo': '57', 'bar': 'bleh'})
예제 #4
0
    def test_sanity_sequence(self):
        tempfile = get_temp_file(self)

        # dump random stuff
        numbers = [random.randint(-3, 200) for _ in range(len(string.ascii_letters))]
        original_data = dict(zip(string.ascii_letters, numbers))
        dump(original_data, tempfile)

        # load and compare
        retrieved_data = load(tempfile)
        self.assertEqual(original_data, retrieved_data)
예제 #5
0
 def __init__(self):
     creds = infoauth.load(os.path.expanduser('~/.tmdb_auth'))
     self.api_key = creds['key']
예제 #6
0
    ('Nacionalidad', 'nacionalidad'),
    ('Estado Civil', 'ecivil'),
    ('Profesión', 'profesion'),
    ('Fecha Nacimiento', 'fnac'),
    ('Domicilio', 'domicilio'),
    ('Forma de pago', 'formadepago'),
    ('Datos que faltan', 'datosquefaltan'),
]

# the row where the titles are
TITLE_ROW = 8

# mail data
MAIL_HOST = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_TOKENS = infoauth.load(
    os.path.expanduser("~/.pyarac-presidencia-mail.tokens"))
FROM = "Facundo Batista <{}>".format(MAIL_TOKENS['user'])

MISSING = """\
Para completar los datos legales, necesito por favor que me pases/ajustes también
lo siguiente: {missing_items}
"""

MAIN_TEXT = """\
Hola!

¡Gracias por completar el formulario!

Te pido por favor que valides los datos:

    Nombre(s):         {nombre}
예제 #7
0
import sys
from urllib import request, parse

import infoauth  # fades
import dropbox  # fades
from bs4 import BeautifulSoup  # fades

headers = {
    'User-Agent': (
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
        "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"),
}

socket.setdefaulttimeout(5)

dropbox_secrets = infoauth.load("/home/facundo/.config/dropbox-secrets")


def search_url(fpath):
    with open(fpath, "rt", encoding="utf8") as fh:
        content = fh.read()
    targets = re.findall(":target:(.*)\n", content)
    links = re.findall(r"`(.*?) \<(.*?)\>`", content, re.S)

    results = set()

    for target in targets:
        results.add(target.strip())
    for description, link in links:
        results.add(link.strip())