def __init__(self, support): UrlCreator.setFactory(Lineage2UrlCreatorFactory()) Adaptor.setFactory(Lineage2AdaptorFactory()) Initializer.setFactory(Lineage2InitializerFactory()) Receiver.setFactory(Lineage2ReceiverFactory()) Parser.setFactory(Lineage2ParserFactory()) Handler.setFactory(Lineage2HandlerFactory()) self.support = support
def parse(self, page_str): Parser.parse(self, page_str) self.lxlmldoc = lxml.html.document_fromstring(page_str) temp = self.lxlmldoc.xpath('//form/input[@name="__VIEWSTATE"]') if temp and len(temp): self.page.setViewState(temp[0].value) temp = self.lxlmldoc.xpath('//form/input[@name="actionKey"]') if temp and len(temp): self.page.setActionKey(temp[0].value) return page_str
def __init__(self, page): Handler.__init__(self, page) self.initializer = Initializer.getInitializer(page) self.adaptor = Adaptor.getAdaptor(page) self.urlCreator = UrlCreator.getUrlCreator(page) self.receiver = Receiver.getReceiver(page) self.parser = Parser.getParser(page)
def __init__(self, page): Parser.__init__(self, page)
from Lib.receiver.lineage2.adaptors import Lineage2AdaptorFactory from Lib.receiver.lineage2.handlers import Lineage2HandlerFactory from Lib.receiver.lineage2.initializers import Lineage2InitializerFactory from Lib.receiver.lineage2.pageTypes import PageType from Lib.receiver.core.receivers import NotLoggedInException, Receiver from Lib.receiver.core.strategy import Page from Lib.receiver.core.supports import EuroSupport from Lib.receiver.lineage2.parsers import Lineage2ParserFactory from Lib.receiver.lineage2.receivers import Lineage2ReceiverFactory from Lib.receiver.lineage2.urlCreators import Lineage2UrlCreatorFactory UrlCreator.setFactory(Lineage2UrlCreatorFactory()) Adaptor.setFactory(Lineage2AdaptorFactory()) Initializer.setFactory(Lineage2InitializerFactory()) Receiver.setFactory(Lineage2ReceiverFactory()) Parser.setFactory(Lineage2ParserFactory()) Handler.setFactory(Lineage2HandlerFactory()) support = EuroSupport(login='******', password='******') page = Page(support, PageType.LIST_LOG) try: # aspx_ = {'url': "/L2Admin/Default.aspx"} params = {'action': "810", "fromDate": "2012-10-07 20:58", "toDate": "2012-10-08 21:58", "worldList": 71} page.get(params) except HTTPError as error: print error except NotLoggedInException: # логинимся login_page = Page(support, PageType.LOGIN_PAGE) try:
from Lib.receiver.lineage2.adaptors import Lineage2AdaptorFactory from Lib.receiver.lineage2.handlers import Lineage2HandlerFactory from Lib.receiver.lineage2.initializers import Lineage2InitializerFactory from Lib.receiver.lineage2.pageTypes import PageType from Lib.receiver.core.receivers import NotLoggedInException, Receiver from Lib.receiver.core.strategy import Page from Lib.receiver.core.supports import EuroSupport from Lib.receiver.lineage2.parsers import Lineage2ParserFactory from Lib.receiver.lineage2.receivers import Lineage2ReceiverFactory from Lib.receiver.lineage2.urlCreators import Lineage2UrlCreatorFactory UrlCreator.setFactory(Lineage2UrlCreatorFactory()) Adaptor.setFactory(Lineage2AdaptorFactory()) Initializer.setFactory(Lineage2InitializerFactory()) Receiver.setFactory(Lineage2ReceiverFactory()) Parser.setFactory(Lineage2ParserFactory()) Handler.setFactory(Lineage2HandlerFactory()) support = EuroSupport(login='******', password='******') page = Page(support, PageType.LIST_LOG) try: # aspx_ = {'url': "/L2Admin/Default.aspx"} params = { 'action': "810", "fromDate": "2012-10-07 20:58", "toDate": "2012-10-08 21:58", "worldList": 71 } page.get(params) except HTTPError as error: