PEP8 Formatting update

This commit is contained in:
Vansh Comar 2021-10-19 00:01:28 +05:30
parent 08fe263eae
commit 08d2074697

View File

@ -253,34 +253,36 @@ def search():
resp_code = 503 if has_captcha(str(response)) else 200 resp_code = 503 if has_captcha(str(response)) else 200
# Feature to display IP address # Feature to display IP address
html_soup = bsoup(response,'html.parser') html_soup = bsoup(response, 'html.parser')
if not html_soup.select_one(".EY24We") and html_soup.select_one(".OXXup").get_text().lower()=="all": if(not html_soup.select_one(".EY24We")
if re.search("([^a-z0-9]|^)my *[^a-z0-9] *(ip|internet protocol)(\Z|( *[^a-z0-9] *(((addres|address|adres|adress)|a)? *\Z)))",query.lower()): and html_soup.select_one(".OXXup").get_text().lower() == "all"):
if re.search("([^a-z0-9]|^)my *[^a-z0-9] *(ip|internet protocol)" +
"($|( *[^a-z0-9] *(((addres|address|adres|adress)|a)? *$)))", query.lower()):
# HTML IP card tag # HTML IP card tag
ip_tag = html_soup.new_tag("div") ip_tag = html_soup.new_tag("div")
ip_tag["class"]="ZINbbc xpd O9g5cc uUPGi" ip_tag["class"] = "ZINbbc xpd O9g5cc uUPGi"
# What is my IP tag # What is my IP tag
q_tag=html_soup.new_tag("div") q_tag=html_soup.new_tag("div")
q_tag["class"]="kCrYT" q_tag["class"] = "kCrYT"
q_tag.string="What's my IP" q_tag.string = "What's my IP"
# Distinction boundary # Distinction boundary
line = html_soup.new_tag("div") line = html_soup.new_tag("div")
line["class"]="x54gtf" line["class"] = "x54gtf"
# For IP Address html tag # For IP Address html tag
ip_address = html_soup.new_tag("div") ip_address = html_soup.new_tag("div")
ip_address["class"]="kCrYT" ip_address["class"] = "kCrYT"
ip_address["style"]="padding-bottom:0;" ip_address["style"] = "padding-bottom:0;"
ip_address.string= request.remote_addr ip_address.string = request.remote_addr
# Text below the IP address # Text below the IP address
ip_text = html_soup.new_tag("div") ip_text = html_soup.new_tag("div")
ip_text.string="Your public IP address" ip_text.string = "Your public IP address"
ip_text["class"]="kCrYT" ip_text["class"] = "kCrYT"
ip_text["style"]="padding-top:0; color: #9e9e9e!important;" ip_text["style"] = "padding-top: 0; color: #9e9e9e!important;"
# Adding all the above html tags to the IP card # Adding all the above html tags to the IP card
ip_tag.append(q_tag) ip_tag.append(q_tag)
@ -290,7 +292,7 @@ def search():
# Finding the element before which the IP card would be placed # Finding the element before which the IP card would be placed
first_link_in_results = html_soup.select_one(".BNeawe.vvjwJb.AP7Wnd") first_link_in_results = html_soup.select_one(".BNeawe.vvjwJb.AP7Wnd")
ref_element = first_link_in_results.find_parent(class_="ZINbbc xpd O9g5cc uUPGi") ref_element = first_link_in_results.find_parent(class_ = "ZINbbc xpd O9g5cc uUPGi")
# Inserting the element # Inserting the element
ref_element.insert_before(ip_tag) ref_element.insert_before(ip_tag)