Python Forum
How to use python variable in javascript
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use python variable in javascript
#1
I have create a GUI to take user information and use it for proxy authentication

proxy = self.pr.text()
port = self.po.text()
username = self.un.text()
pw = self.pw.text()

these are the variables assigned.

i want to use these variables in

background_js = """
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "http",
host: PROXY,
port: parseInt(PORT)
},
bypassList: ["foobar.com"]
}
};

chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});

function callbackFn(details) {
return {
authCredentials: {
username: USERNAME,
password: PASSWORD
}
};
}

chrome.webRequest.onAuthRequired.addListener(
callbackFn,
{urls: ["<all_urls>"]},
['blocking']
);
"""

As i have used those variables here(CAPITALISED) but this doen not seem to work
Any suggestions?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python script - search Apache access_log.txt for all of the JavaScript (.js) jnovak 7 4,272 May-04-2020, 07:02 AM
Last Post: snippsat
  Run Script written in javascript from python Scientifix 3 3,253 Apr-28-2018, 06:48 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020