Page 404 through Python Requests but loads fine through browser

112 views Asked by At

Getting page 404 with Python Requests but I can access the page no problem through my browser. I can access other pages that are formatted exactly the same as this page and they load no problem.

Have already tried changing headers with no luck.

My Code:

string_page = str(page)
with requests.Session() as s:

    resp = s.get('https://bscscan.com/token/generic-tokentxns2?m=normal&contractAddress=0x470862af0cf8d27ebfe0ff77b0649779c29186db&a=&sid=f58c1cdefacc680b799412c7645ed7f7&p='+string_page)

    page_info = str(resp.text)

print(page_info)

I have also tried with urllib and the same thing happens

1

There are 1 answers

1
Tarun Gopalkrishna On

I'm not sure if this will fix it, but try adding this in the header maybe it might work

'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36'