Sign inSign up

imflow/url2image

By imflow

•Updated over 6 years ago

A microservice that turns an URL into an image

Image
0

1.1K

imflow/url2image repository overview

Build Status Coverage Status License: MIT Documentation Status

⁠URL2Image

A microservice that turns an URL into an image aka it takes a screenshot of the website.

⁠What it is

URL2Image provides an API, which accepts a URL and returns a rendered image of the URL.

⁠Installation

Either clone the repo and run it yourself:

git clone https://github.com/ImFlow/URL2Image.git

and then run it via:

docker build -t url2image .
docker run -d -p 5000:5000 url2image

or use the prebuild docker image:

docker pull imflow/url2image
docker run -d -p 5000:5000 url2image

there is also a docker-compose.yml file included so the service can be run using:

docker-compose up

⁠How To Use

To download an url as a png file call the /getImage endpoint.

curl "localhost:5000/getImage?url=google.de" -o test.png

Supported options are url to specify the url of the target. This is required. width and height are optional parameters specifiing the image dimensions.

curl "localhost:5000/getImage?url=google.de&width=400&height=400" -o test.png

A basic login can be achieved via:

curl -H "Content-Type: application/json" -X POST -d '{"username":"user", "password":"url2image" }' "http://localhost:5000/login"
{
    "access_token": "TOKEN"
}

The authorization is then done in the header::

curl -H "Authorization: Bearer TOKEN" "http://localhost:5000/getImage?url=google.de"

⁠Documentation

More documentation can be found here⁠

⁠Configuration

The service can be configured using environtment variables:

Variable Description Default Value
JWT_SECRET_KEYSecret key for the JWT access tokensRandom String
JWT_USERThe username for the JWT authentification"user"
JWT_PASSWORDThe password for the JWT authentification"url2image"
FLASK_DEBUGRun in debug mode. Currently only disables the DDos protectionnot set
USE_LOGINEnables the authorization requirement for the service True
JWT_ACCESS_TOKEN_EXPIRESExpiration time of the JWT in seconds or False for no expiration False

⁠TODO

:white_check_mark: Design API

:white_check_mark: Provide API endpoints

:white_check_mark: DDos protection

:white_check_mark: JWT authentification

:white_check_mark: Username/Password authentification

:white_check_mark: Configs

:white_check_mark: Image format selection (jpg/png)

  • Add a standalone Program

Tag summary

Content type

Image

Digest

Size

611.8 MB

Last updated

over 6 years ago

docker pull imflow/url2image