0

I've already searched quite a bit but came to now clear conclusion as some projects (pyv8) seem to be dead and I'm not sure if that is suitable at all. The 3rd part lib requires a DOM, eg. a container element in which it runs. It also uses web assembly and in general is pretty heavy.

Not sure if libs like pyv8 would actually be suitable for that. Other approach would be to go with selenium and headless chrome or a local node.js service but both of these sound very heavy. Oh, and the lib must work in windows as that's simply company policy, windows servers so PyMiniRacer is out.

What are my other options?

beginner_
  • 7,230
  • 18
  • 70
  • 127
  • What is your definition of heavy vs very heavy? When dealing with Website Automation, I LOVE selenium. I used it to log into the same web app 500 times with different creds as sometimes I am trying to stress websites (or chat rooms) for work. If what you are doing is predictable, then that is the tool for you. – Fallenreaper Oct 21 '19 at 17:22
  • @Fallenreaper the library uses web assembly heavily and total payload mostly form (w)asm files is 30 MB. I'm not sure if it can even be used outside of a full browser context (DOM). – beginner_ Oct 22 '19 at 04:55

1 Answers1

0

Consider taking a look at this post: How do I call a Javascript function from Python?.

However, if your objective is to access JS code in a webpage for reasons such as webscraping, you could also consider using selenium webdriver + python to do so. Take a look at this medium.com post: How to Run JavaScript in Python | Web Scraping | Web Testing

Other Resources:

  1. https://www.quora.com/How-do-we-use-JavaScript-with-Python
  2. Python to JS: https://pypi.org/project/javascripthon/

P.S: I am not sure if this would help you. There is another library (PyExecJS) which is maintained no longer; but I think you have looked it up already.

CypherX
  • 7,019
  • 3
  • 25
  • 37