Esempio n. 1
0
 def __init__(self,
              url,
              name=None,
              code=None,
              use_ex_handle=True,
              exist_verify=True,
              lan_url=None,
              proxies=None,
              priority_proxy=False,
              timeout=10,
              login_url_path=None,
              url_path_list=None,
              class_time_list=None,
              session=None):
     school = {
         'code': code,
         'lan_url': lan_url,
         'proxies': proxies,
         'timeout': timeout,
         'name': to_text(name),
         'exist_verify': exist_verify,
         'use_ex_handle': use_ex_handle,
         'priority_proxy': priority_proxy,
         'login_url': login_url_path or "/default2.aspx",
         'url_path_list': url_path_list or URL_PATH_LIST,
         'time_list': get_time_list(class_time_list or CLASS_TIME)
     }
     self.base_url = url.split('/default')[0] if url[-4:] == 'aspx' else url
     self.session = session or MemoryStorage()
     self.school = ObjectDict(school)
Esempio n. 2
0
 def __init__(self,
              url,
              name=None,
              code=None,
              use_ex_handle=True,
              exist_verify=True,
              lan_url=None,
              proxies=None,
              priority_proxy=False,
              timeout=10,
              login_url_path='/default2.aspx',
              url_endpoint=URL_ENDPOINT,
              class_time_list=CLASS_TIME,
              session=MemoryStorage):
     school = {
         'code': code,
         'lan_url': lan_url,
         'proxies': proxies,
         'timeout': timeout,
         'name': to_text(name),
         'login_url': login_url_path,
         'url_endpoint': url_endpoint,
         'exist_verify': exist_verify,
         'use_ex_handle': use_ex_handle,
         'priority_proxy': priority_proxy,
         'time_list': get_time_list(class_time_list)
     }
     self.base_url = url.split('/default')[0] if url[-4:] == 'aspx' else url
     self.session = session(school['code'])
     self.school = ObjectDict(school)
Esempio n. 3
0
    def __init__(self, url, **kwargs):
        url = url.split('/default')[0] if url[-4:] == 'aspx' else url
        class_time_list = kwargs.get('class_time_list') or CLASS_TIME
        time_list = get_time_list(class_time_list)

        self.school = {
            'url': url,
            'debug': kwargs.get('debug'),
            'name': to_text(kwargs.get('name')),
            'code': kwargs.get('code'),
            'use_ex_handle': kwargs.get('use_ex_handle', True),
            'exist_verify': kwargs.get('exist_verify', True),
            'lan_url': kwargs.get('lan_url'),
            'proxies': kwargs.get('proxies'),
            'priority_proxy': kwargs.get('priority_proxy'),
            'timeout': kwargs.get('timeout', 10),
            'login_url': kwargs.get('login_url_path', '/default2.aspx'),
            'url_endpoint': kwargs.get('url_endpoint') or URL_ENDPOINT,
            'time_list': time_list
        }
        storage = kwargs.get('session', MemoryStorage)
        self.session = storage(self.school['code'])
        self.school = ObjectDict(self.school)