0

There's a href link with # in a website's source code:

<li class="tab-real-estate-index"><a href="#realestate-index" id="realEstateTab">Emlak Endeksi</a></li>

I can send connection request to it's normal link (/path/linktoRealEstate/details) with following command. It returns HTTP Status 200 to me:

import http.client
conn = http.client.HTTPSConnection("www.website.com")
myLink= f"/path/linktoRealEstate/details"
conn.request("GET",myLink,payload, headers)

But when I send connection request to /path/linktoRealEstate/details#realestate-index, it returns me 400 error.

<!DOCTYPE html>
<html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>

How can I get HTTP status 200 with Python?

Soul
  • 13
  • 4
  • It returns HTTP Status 400 HTTP Status 400 – Bad Request

    HTTP Status 400 – Bad Request

    – Soul Jul 15 '22 at 19:54
  • look here https://stackoverflow.com/questions/4855168/what-is-href-and-why-is-it-used, then the page with the # is the same – Tortar Jul 15 '22 at 19:54
  • I can click that link with a Javascript code on my browser's debug console . document.getElementById('realEstateTab').click() .. Is that possible to use this code via python ? – Soul Jul 15 '22 at 20:02
  • Yes I think you can use Selenium library for this type of things – Tortar Jul 15 '22 at 20:05

0 Answers0