예제 #1
0
파일: api.py 프로젝트: jose2190/guicavane
def setup(username=None, password=None, cache_dir="/tmp/", cache_lifetime=60 * 60 * 6):
    """ Does the inicialization and login of the website. """

    # Singleton
    cached = Cached.get()
    cached.set_cache_dir(cache_dir)
    cached.set_lifetime(cache_lifetime)

    if username:
        data = {"usuario": username, "password": password, "ingresar": True, "recordarme": "si"}
        ret = url_open(urls.login, data=data)
        if username not in ret:
            raise Exception("Login fail, check username and password")
예제 #2
0
파일: api.py 프로젝트: nikod/guicavane
def setup(username=None, password=None,
        cache_dir='/tmp/', cache_lifetime=60*60*6):
    """ Does the inicialization and login of the website. """

    # Singleton
    cached = Cached.get()
    cached.set_cache_dir(cache_dir)
    cached.set_lifetime(cache_lifetime)

    if username:
        data = {'usuario': username, 'password': password,
                'ingresar': True, 'recordarme': 'si'}
        ret = url_open(urls.login, data=data)
        if username not in ret:
            raise Exception('Login fail, check username and password')
예제 #3
0
파일: util.py 프로젝트: jose2190/guicavane
#!/usr/bin/env python
# coding: utf-8

import time
import urllib
import urllib2
import cookielib
import functools
from StringIO import StringIO
from unicodedata import normalize

from cached import Cached

cached = Cached.get()

HEADERS = {
    'User-Agent': 'User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 '
                  '(KHTML, like Gecko) Chrome/13.0.772.0 Safari/535.1',
    'Referer': 'http://www.cuevana.tv/',
    'Accept': 'text/html,application/xhtml+xml,application/xml;'}

RETRY_TIMES = 5


def normalize_string(string):
    """
    Take a string and return a cleaned string ready to use for cuevana
    """

    repl_list = [" ", ".", ",", "'", "?", "$", "#",
                 "*", "!", ":", "(", ")"]