Ghost.py | Webkit based scriptable web browser for python | Web Framework library
kandi X-RAY | Ghost.py Summary
kandi X-RAY | Ghost.py Summary
Webkit based scriptable web browser for python.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Decorator that ensures that the page can be loaded
- Wait until the requested page is loaded
- Wait until condition is met
- Get the list of http resources
- Sleep forever
- Prompt the user
- Return the value of the given value
- Create a request object
- Callback called when a reply is ready
- Waits until a selector is found
- Checks whether given selector exists
- Evaluate a JavaScript file
- Evaluate a script
- Handle unsupported content
- Add the response content to the list
- Called when the page is loaded
- Invoked by the user
- Display the alert message
Ghost.py Key Features
Ghost.py Examples and Code Snippets
$ pip3 install pycrypto
$ pip3 install cython
cd [where fluxclient repository is]
if you didn't install pcl:
$ python3 ./setup.py develop --without-pcl
else:
$ python3 ./setup.py develop
$ python3 ./ghost.py --ip 0.0.0.0 --port 10000
browser = webdriver.PhantomJS(executable_path=r'C:\\Utility\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
browser.get("http://www.google.com")
html = browser.page_source
browser.save_screenshot('./Screenshots/PhantomJS_normal.png')
browse
for input in inputData:
session.evaluate('document.querySelector(\'input[name="DataForm"]\').value= "%s";' % input)
zaphoxx@zaphoxx /usr/local/src/ghostInTheShell $ gcc -fno-stack-protector -o ghost ghost.c ; sudo chown root:root ghost ; sudo chmod 4755 ghost; ll ./ghost;
-rwsr-xr-x 1 root root 8816 Oct 18 12:22 ./ghost*
zaphoxx@zaphoxx /usr/local/src/g
import pdfkit
pdfkit.from_url('https://www.google.co.in/search?q=ghost+py+save+as+pdf&oq=ghost&aqs=chrome.1.69i57j69i59j69i60l4.5364j0j1&sourceid=chrome&ie=UTF-8', 'out.pdf')
Community Discussions
Trending Discussions on Ghost.py
QUESTION
I'm trying to fill a form several times with Ghost.py, the values I need to input to the form are inside a list, the program looks like this:
...ANSWER
Answered 2018-Jun-05 at 05:00Did you try using a for loop?
QUESTION
This simple script - to check whether a process is running and then send an email if it's not - works fine:
...ANSWER
Answered 2018-May-09 at 07:01Drop the brackets as it's completely another command (usually equivalent to test
):
QUESTION
How to make screenshot from any url (web page)?
I was trying:
...ANSWER
Answered 2018-Mar-01 at 13:14In the late 80's this may have been a simple task, just render some html to an image instead of the screen.
But these days web-pages require client-side execution to build parts of its DOM and re-render based on client-side initiated AJAX (or equivalent) requests... it's a whole thing "web 2.0" thing.
Rendering a web-site such as http://google.com as a simple html return should be easy, but rendering something like https://www.facebook.com/ or https://www.kogan.com/ will have many back & fourth comms to display what you're expecting to see.
So restricting this to a pure python solution may not be plausible; I'm not aware of a python-based browser. Consider running a separate service to take the screenshots, and use your core application (in python) to fetch requested screenshots.
I just tried a few with docker, many of them struggle with https
and the aforementioned ajax
behaviour.
earlyclaim/docker-manet appears to work demo page
edit: from your comments, you need the data from a graph that's rendered using a 2nd request.
you just need the json return from https://www.minnowbooster.net/limit/chart
QUESTION
I'm opening a web page in ghost.py
in IPython interactive console and showing its window to see the effect of my actions:
ANSWER
Answered 2018-Jan-26 at 07:27Running the %gui qt
IPython magic command before invoking ghost.Ghost().start()
does the trick.
Judging by IPython/terminal/pt_inputhooks/qt.py
, it creates a global Qt even loop and pumps events while the console is idle or something.
QUESTION
from ghost import Ghost
...ANSWER
Answered 2017-Dec-21 at 20:33Your program is trying to import itself, since the first module ghost
it finds is your ghost.py
.
Renaming your program will fix this problem.
QUESTION
In my web application, the user is able to draw some objects. The drawing functionality is implemented (at client-side) using d3js (SVG). The attributes of the objects (shape, coordinates, colours) are saved at server-side in a structured database.
Now, I need to render the drawings at server-side as well. I would like to reuse (at server-side) the rendering logic implemented at client-side. That is, to obtain a SVG (then convert it to PNG / PDF), given the object attributes saved in the database.
I see (at least) the following options:
- install NodeJS on Heroku as well, and execute node from my Python web application. This would require JSDOM if I understood well - see this;
- use ghost.py to open a local HTML file that does the actual rendering (using d3js);
- send the rendered SVG from client-side to the back-end - this is a poor choice, though.
What is your recommendation?
Later edit
Ghost.py
is not an option, since it requires PyQt or PySide, neither of which can be installed on Heroku. See this.
PhantomJS
seems a great choice.
Some references
...ANSWER
Answered 2017-Jun-17 at 19:12I wouldn't recommend the third option because going back and forth from client to server can cause issues, and best to avoid it.
The first option would work, but then you have a whole framework for one specific problem.
I like the second option, using ghost.py, because it's conceptually easy to understand, and very lightly couples with other parts of the codebase, which is always a goal in well written projects.
You can also use phantomJS to run this (or something like it), which is the same kind of approach as ghost.py, but straight to the javascript.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Ghost.py
You can use Ghost.py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page