import re import pickle import datetime import urllib.request from xml.dom import minidom from urllib.parse import urlparse from models.base import AbstractOffer, AbstractProvider from pymemcache.client.base import Client as MemClient import re import lxml.etree as etree from io import StringIO mem_client = MemClient(('localhost', 11211)) class ContentDispatcher: def __init__(self, content): self.content = content def get_value_by_re(self, pattern): ms = re.search(pattern, self.content) if ms is None: return None st = ms.group(1).strip() if st == '': return None return st
def init(self): self.expiration = None self.client = MemClient(('localhost', 11211))