names = [] import bs4 as bs import requests def disco(page) -> list: headers = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', # 'Accept-Encoding': 'gzip, deflate, br', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'none', 'Sec-Fetch-User': '?1', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', } data = { 'pg': page, 'term': '', 'paginate': '1', 'ym': '0', 'showmiddlename': '0', 'listcity': '0', 'tgt': 'obitlist', 'numlistings': '10', 'sids': '10627', 'typ': '1', 'txtsrch': '0', } response = requests.post('https://www.tharpsontheimerfh.com/pax/obitsrch', headers=headers, data=data) return response.text for i in range(0, 191): soup = bs.BeautifulSoup(disco(i), 'lxml') for link in soup.select(".obitlist-title a"): names.append(link.get('href').split("/")[2]) print(i) name_ = (" tharpsontheimerfh:".join(names)) print(name_) headers = { 'Content-Type': 'multipart/form-data; boundary=---------------------------13612081884110273351021381409', 'Origin': 'http://localhost:8501', 'Authorization': 'Basic dGhldGVjaHJvYm86ZWxpdmVJU3RoZWJlc3Q0OQ==', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8501/funeralhomes/admin/queues', 'Upgrade-Insecure-Requests': '1', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-User': '?1', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', } data = '-----------------------------13612081884110273351021381409\r\nContent-Disposition: form-data; name="queue"\r\n\r\ntodo\r\n-----------------------------13612081884110273351021381409\r\nContent-Disposition: form-data; name="downloader"\r\n\r\n\r\n-----------------------------13612081884110273351021381409\r\nContent-Disposition: form-data; name="check"\r\n\r\nno\r\n-----------------------------13612081884110273351021381409\r\nContent-Disposition: form-data; name="items"\r\n\r\n%s\r\n-----------------------------13612081884110273351021381409\r\nContent-Disposition: form-data; name="items-file"; filename=""\r\nContent-Type: application/octet-stream\r\n\r\n-----------------------------13612081884110273351021381409--\r\n' print(requests.post('http://localhost:8501/funeralhomes/admin/queues', allow_redirects=False, headers=headers, data=data % name_).headers.get("Location"))