adding our own user-agent else offpunk is considered as a bot by many http servers
This commit is contained in:
parent
c038fc9579
commit
1881b98d96
|
@ -399,6 +399,7 @@ class HtmlRenderer():
|
||||||
# the real render_html hearth
|
# the real render_html hearth
|
||||||
readable = Document(body)
|
readable = Document(body)
|
||||||
summary = readable.summary()
|
summary = readable.summary()
|
||||||
|
#summary = body
|
||||||
#r_body += "\x1b[1;34m\x1b[4m" + self.get_title() + "\x1b[0m""\n"
|
#r_body += "\x1b[1;34m\x1b[4m" + self.get_title() + "\x1b[0m""\n"
|
||||||
soup = BeautifulSoup(summary, 'html.parser')
|
soup = BeautifulSoup(summary, 'html.parser')
|
||||||
rendered_body = ""
|
rendered_body = ""
|
||||||
|
@ -1031,7 +1032,9 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
|
|
||||||
|
|
||||||
def _fetch_http(self,gi):
|
def _fetch_http(self,gi):
|
||||||
response = requests.get(gi.url)
|
header = {}
|
||||||
|
header["User-Agent"] = "Offpunk browser v%s"%_VERSION
|
||||||
|
response = requests.get(gi.url,headers=header)
|
||||||
mime = response.headers['content-type']
|
mime = response.headers['content-type']
|
||||||
body = response.content
|
body = response.content
|
||||||
if "text/" in mime:
|
if "text/" in mime:
|
||||||
|
|
Loading…
Reference in New Issue