Screamshot
Python library to capture screenshots of web applications
Good practices
- Any code addition must be done in your own branch. You can name it
fl/what_this_branch_bringswhere 'f' is the first letter of your first name and 'l' the first letter of your last name. - A branch resolves a specific issue.
- Please write exhaustive tests. The coverage must not decrease.
- Please merge the master branch into yours, run the tests and checks and correct all errors and warnings before pushing your code.
- When you think you have finished you can make a pull request.
Testing and checks
To start the tests and checks
The first time
- Install docker and docker-compose.
- Run:
docker-compose build, to create all the required images. - To start the verification, run:
docker-compose up.
When it is already setup
You just need to run docker-compose up.
To clean up
- If you want to stop containers and remove containers, networks, volumes, and images created by up command, run:
docker-compose down. - If you want to delete all the images, run:
docker rmi -f $(docker images -q).
To write new tests
- You must use the
unittestpackage - You must put your test file in the tests folder
- You must name your test file using the following next pattern: test_*.py
Local server
A server with a web page can be used at the following address: http://server:5000/index.html and http://server:5000/other.html
Usage
Documentation
The documentation is accessible here, on readthedocs.
Exemple with django
The server must be launched using --nothreading and --noreload as argument.
# views.py in a Django project
from django.http import HttpResponse
import asyncio
from screamshot import generate_bytes_img_prom
def home(request):
loop = asyncio.get_event_loop()
future = asyncio.Future()
asyncio.ensure_future(
generate_bytes_img_prom('https://www.google.fr', future))
loop.run_until_complete(future)
return HttpResponse(future.result(), content_type='image')
Or using the already wrapped function
# views.py in a Django project
from django.http import HttpResponse
from screamshot import generate_bytes_img__django_wrap
def home(request):
img = generate_bytes_img__django_wrap('https://www.google.fr')
return HttpResponse(img, content_type='image')
Using Gunicorn
With Gunicorn there isn't the thread related problems so we don't need to use the --nothreading and --noreload arguments.
CHANGELOG
0.0.1
Initialization of Screamshot library
- init file:
- author
- version
- all
- core file:
- A
ScreenShotobject with three methods:load, loads a web pagescreamshot, takes a screenshot of a loaded pageload_and_screamshot, loads a web page and takes a screenshot
- A
0.1.0
- There is no more
ScreenShotobject just a function namedgenerate_bytes_imgwhich takes some parameters and returns a binarybytesobject.
0.1.1
generate_bytes_imgis no more a sync function andgenerate_bytes_img_promhas been addedgenerate_bytes_img_promuses theasyncio.Futureobject
0.1.2
- A test and verification tool using Docker is now available
0.1.3
- Add
browser-managerscript - Add
screamshotscript
0.1.4
- Add
serializefunction - Add
deserializefunction
0.1.5
- Add
generate_bytes_img_django_wrapfunction
0.1.6
- Module is now available
0.1.7
- The browser endpoint is saved in the temporary directory
0.1.8
serializefunction returns adictobjectdeserializetakes adictobject
0.1.9
- Remove serializer functions
- Add a bytes_to_img function
0.1.10
generate_bytes_img_django_wrapis renamedgenerate_bytes_img_wrap- Error are handled
0.1.11
bytes_to_pngis renamedbytes_to_filebytes_to_filesupports type choice
0.1.12
- You can now fetch http headers from another page with
get_token - And store these headers in the local storage
Metadata
Release files for screamshot 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| screamshot-0.1.12.tar.gz | 10.7 kB | Without provenance | Details for screamshot-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| screamshot-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for screamshot-0.1.12-py3-none-any.whl |
Total release size: 30.4 kB
Release files / screamshot-0.1.12.tar.gz
| Download URL | screamshot-0.1.12.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18eb7dc3870515ca6cdbfedc4ffb699eca8747381eeafcd5780dc61fe31228bc
|
|
BLAKE2b-256 checksum How to use checksums |
81bd6ac31bac93952d3ef5f52c7fbfda9becf49397a56e9673170e7fa5eeed59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16
|
Release files / screamshot-0.1.12-py3-none-any.whl
| Download URL | screamshot-0.1.12-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b058803b2a2ba84211c0bada47638070e1e9738f07f1190867f96af0bf4c4b54
|
|
BLAKE2b-256 checksum How to use checksums |
20597f7bf2666b0f31a585af7df2e60e6c252cb6503e7a48366218d2c22e2013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16
|
Security for screamshot 0.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.