I'm trying to create a script using python in combination with seleniumwire implementing poxies within it. The script sometimes works correctly but most of the time comes up with error log details even when the status_code is 200. I wish to get rid of those log details. The ip address that is hardcoded within the script is taken from a free proxy site, so it might not be of any use at this moment.
This is what I'm trying with:
from seleniumwire import webdriver
URL = 'https://www.zillow.com/Houston,-TX/houses/'
options = {
'mitm_http2': False,
'proxy': {'https': f'https://136.226.33.115:80'}
}
driver = webdriver.Chrome(seleniumwire_options=options)
driver.get(URL)
assert driver.requests[0].response.status_code==200
post_links = [i.get_attribute("href") for i in driver.find_elements_by_css_selector("article[role='presentation'] > .list-card-info > a.list-card-link")]
for individual_link in post_links:
driver.get(individual_link)
assert driver.requests[0].response.status_code==200
post_title = driver.find_element_by_css_selector("h1").text
print(post_title)
driver.quit()
This is the type of error log details I can see in the console:
127.0.0.1:55825: request
-> HTTP protocol error in client request: Server disconnected
127.0.0.1:55967: request
-> HTTP protocol error in client request: Server disconnected
127.0.0.1:64891: request
-> HTTP protocol error in client request: Server disconnected
127.0.0.1:61466: request
-> HTTP protocol error in client request: Server disconnected
127.0.0.1:51332: request
-> HTTP protocol error in client request: Server disconnected
127.0.0.1:52783: request
-> HTTP protocol error in client request: Server disconnected
How can I force the script not to print those log details?
from Can't force a script not to print error log details in the console
No comments:
Post a Comment