Add user-agent
This commit is contained in:
parent
00386298c6
commit
78f23db211
@ -1,2 +1,3 @@
|
|||||||
[default]
|
[default]
|
||||||
home = https://example.com
|
home = https://example.com
|
||||||
|
useragent = BirdyNet/$VER ($OS)
|
@ -83,6 +83,7 @@ class browserWindow(QMainWindow):
|
|||||||
# additional info:
|
# additional info:
|
||||||
"baseUrl": ""
|
"baseUrl": ""
|
||||||
}
|
}
|
||||||
|
self.cUserAgent = config["default"]["useragent"].replace("$OS",sys.platform).replace("$VER",versionString).replace("$DIST",distro)
|
||||||
self.cCreateElements()
|
self.cCreateElements()
|
||||||
|
|
||||||
def cCreateElements(self):
|
def cCreateElements(self):
|
||||||
@ -119,7 +120,7 @@ class browserWindow(QMainWindow):
|
|||||||
def cNavigate(self,event = None):
|
def cNavigate(self,event = None):
|
||||||
try:
|
try:
|
||||||
print(prettyJson(parseUrl(self.cUrlBar.text())))
|
print(prettyJson(parseUrl(self.cUrlBar.text())))
|
||||||
response = downloadPage(self.cUrlBar.text())
|
response = downloadPage(self.cUrlBar.text(),{"User-Agent": self.cUserAgent})
|
||||||
infoFetcher(response)
|
infoFetcher(response)
|
||||||
self.cDocumentInfo = response
|
self.cDocumentInfo = response
|
||||||
self.cDoc.cRenderHtml(response["body"].decode("utf-8",errors="ignore"))
|
self.cDoc.cRenderHtml(response["body"].decode("utf-8",errors="ignore"))
|
||||||
|
Loading…
Reference in New Issue
Block a user