def __init__(self): self.authority = r'https://www.wenku8.net' self.loginurl = r'https://www.wenku8.net/login.php?do=submit&jumpurl=http%3A%2F%2Fwww.wenku8.net%2Findex.php' self.pageurl = r"/modules/article/articlelist.php?page=" self.username = r'' self.password = r'' self.formdata = {} self.formdata['username'] = self.username self.formdata['password'] = self.password self.formdata['usecookie'] = '0' self.formdata['action'] = r'login' self.formdata[ 'submit'] = r'%26%23160%3B%B5%C7%26%23160%3B%26%23160%3B%C2%BC%26%23160%3B' self.headers = {} self.headers['origin'] = r'https://www.wenku8.net' self.headers[ 'referer'] = r'https://www.wenku8.net/login.php?jumpurl=http%3A%2F%2Fwww.wenku8.net%2Findex.php' self.headers['upgrade-insecure-requests'] = '1' self.headers[ 'user-agent'] = r'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' self.session = requests.Session() self.manager = UrlManager() self.downloader = UrlDownloader() self.parser = UrlParser(self.session)
10006: "Odbiór w punkcie po przedpłacie - PACZKA W RUCHu", 10022: "Odbiór w punkcie po przedpłacie - Paczkomaty 24/7", 10023: "Odbiór w punkcie po przedpłacie - Allegro Paczkomaty InPost", 10060: "Odbiór w punkcie po przedpłacie - Paczka24 Odbiór w Punkcie", 10061: "Odbiór w punkcie po przedpłacie - E-PRZESYŁKA / Paczka48 Odbiór w Punkcie", 20006: "Odbiór w punkcie - PACZKA W RUCHu", 20022: "Odbiór w punkcie - Paczkomaty 24/7", 20023: "Odbiór w punkcie - Allegro Paczkomaty InPost", 20060: "Odbiór w punkcie - Paczka24 Odbiór w Punkcie", 20061: "Odbiór w punkcie - E-PRZESYŁKA / Paczka48 Odbiór w Punkcie" } client = Client(wsdl) url = "http://allegro.pl/listing/listing.php?generalDelivery_rec=1&vat_invoice=1&standard_allegro=1&startingTime=7&buyNew=1&offerTypeBuyNow=1&order=d&price_to=1000&string=samsung&bmatch=engagement-v6-promo-sm-sqm-fall-ele-1-1-1214&city=Pozna%C5%84" url_parser = UrlParser() params = url_parser.parse(url) alle_options_parser = AlleOptions(client) options = alle_options_parser.get_options(params) api_methods = ApiMethods(client) api_version = api_methods.get_version() session = api_methods.get_session(api_version) items = api_methods.get_items_list(options) item_ids = [x.itemId for x in items] calculated_items = []
def test_parse(self): url_parser = UrlParser() url = "http://allegro.pl/listing/listing.php?order=d&string=asd&bmatch=engagement-v6-promo-sm-sqm-dyn-v2-aut-1-1-1120&buyNew=1&offerTypeBuyNow=1&price_from=1&price_to=2&city=test&startingTime=6&state=9&standard_allegro=1&freeReturn=1&freeShipping=1&personal_rec=1&vat_invoice=1&generalDelivery_rec=1" self.assertEqual(url_parser.parse(url), {'search': 'asd', 'offerType': ['buyNow'], 'condition': ['new'], 'price': {'min': '1', 'max': '2'}, 'city': 'test', 'state': '9', 'startingTime': '12h', 'offerOptions': ['freeReturn', 'freeShipping', 'personalReceipt', 'vatInvoice', 'generalDelivery', 'standardAllegro']})