problem with the library named requests_html in python | Sololearn: Learn to code for FREE!

+1

problem with the library named requests_html in python

see the code; Code link:https://code.sololearn.com/cEH7fyfQbLO4/#py list2.txe link:https://pastebin.com/raw/ZTbhiWAF When i run code without for loop it is working fine but when i run code with "for" loop it returns "<Response 404>" help me plz

5/24/2020 11:44:51 AM

𝖆𝖙.π–šπ•·

6 Answers

New Answer

+2

OK, finally i got it this problem because, i am reading lines(file.readlines()) and it return "\n" character in url so my final url becomes "https://domain.com/b"+"\n and i got [<Response 404>]

+2

Well, the 404 error is simply "Page not found", so perhaps one of your URLs is not valid.

+2

at.ul import subprocess import sys def install(package): subprocess.call([ sys.executable, "-m", "pip", "-q", "install", package ]) install('requests') install('beautifulsoup4') import requests from bs4 import BeautifulSoup help(requests) print() help(BeautifulSoup) I don't know how it works, but I only know it is used to install any module I hope, it'll help you

+2

at.ul Make sure the links are valid and print them out -- maybe there is something wrong with string concatenation or simply the page has changed/moved.

+1

at.ul are you running this on your local machine when it fails? requests and bs4 are not available on Sololearn without the trick πŠπ’π’π›π¨ π†π‘πšπ²πšπ₯ shared. I have some code I do it a little differently with a "try and except" using the older os.system method (subprocess module replaces a lot of the os module functionality, but I just havent spent any time learning it yet.)... https://code.sololearn.com/c2sy4G420Y33

-1

@Kuba SiekierzyΕ„ski but link is valid