Django on Heroku - browser emulator with javascript plugin - python

I'm writing a project in Django which is to run on Heroku PaaS. Within my code base, I would like to be able to perform some tests on links, ex.: open them in a browser.
What's most important to me is that I need to execute the javascript.
Are there any emulators of browser in Python which supports javascript emulation (I know mechanize doesn't, I tried splinter and spynner - but I have some difficulties in using them on heroku, to use splinter I'd need PyQt, to use spynner I'd need firefox - and I don't know how to install them - I guess it is not possible, is it?).
Of course I'm not fixed on Python. I mean, I've thought about another possibility - to write a Perl script (I have already written a script which does what I want it to do) and execute it from Python (I know how to do that) - but I don't know if it's possible to run Perl script from a Python code on Heroku.
Can anybody help me please?
Regards,
Natalia

Related

how to run multiple python files in selenium from a python automation using commands?

I need to run multiple python files (which I can do, but I can't run them at the same time simultaneously), however, these files are running selenium, and I can't get them to work (without selenium they run normally, but when it comes to it's web scrapping it doesn't work at all). After researching I realized that a lot is said about selenium not being suitable for this task. I would like to know if there is any way for this to work, if I can make a python file run others in selenium simultaneously, if not, is there any other language or plugin that does this? I'm looking to know if the puppeteer performs this task, so any information is essential!!

Is it possible to display a python result with react?

I want to write a program using python as logic, because of the extensive libraries available in python suited for this project, and to develop the UI using react.
Is this at all possible, or is there a different method which is easier?
if you want to use react as a front end for a website, you could run python as the back end using something like flask or Django. Python can't be run in the browser, you'll need to run python on a server or run in locally on your machine if the project is just for you.

Can I use Apache, cgi-bin, and Python?

My question is more theoretical than anything.
What I have:
Linux machine
A python script that runs an entire suite of tests.
The same script prints out all of the information to the terminal.
Currently, the way we run our software suite is via SSH to the machine, running python3 MyScript.py and then checking the output.
My goal is to create an interface that would work on a Linux/Windows machine and tablet, and would be able to execute the script, as well as visually display progress of it.
I figured, the best approach (also possibly the easiest?) is to use a web server. Web Interface is fairly universal regardless of platform it is being accessed from. And the backend is as simple as apt get install apache2 and voila! Done!
However, I have never had experience setting up cgi-bin, etc. My question is: is it actually feasible? Am I able to have an HTML button that when clicked will execute MyScript.py server-side and perhaps even parse through whatever the script is outputting to the terminal. That way I would know exactly what the script is doing, and its progress.
Any help regarding this approach (or technologies I can use) is greatly appreciated!

How do I run python script within swift app?

I am making an app which will login to a website and scrape the website for the information I have. I currently have the all the login and web scraping written in Python completely done. What I am trying to figure out is running that python code in Xcode in my swift project. I want to avoid setting up a server capable of executing cgi scripts. Essentially the user will input their credentials and I will pass that to the python file, and the script will run.
Short answer: You don't.
There is no Python interpreter running on iOS, and Apple will likely neither provide nor allow one, since they don't allow you to deliver and run new code to in iOS app once it's installed. The code is supposed to be fixed at install time, and Python is an interpreted language.

Distributing py program involving PhantomJS

I have a Python program that works with Selenium and PhantomJS, and I’d like to distribute it. The functionality is quite simple; it goes onto a website, fills certain forms and returns the outcome, without any visible browser action.
The problem is that I can’t expect an arbitrary user to have PhantomJS installed on their computers. How should I approach the distribution process?
I already checked Setuptools and PythonAnywhere, but I don’t think they work for what I want.
Edit: May be too hopeful, but I'd like to be able to distribute it for Windows, OSX and Ubuntu.
The way I do it is through a web application built on Flask (one of many great python web frameworks) and hosted on PythonAnywhere.
To use PhantomJS and Selenium in PythonAnywhere you have to ask for Docker Consoles. Instructions here: https://www.pythonanywhere.com/forums/topic/1320/

Categories

Resources