url2_image package


url2_image.app module

GET /getImage

Main API endpoint. This takes in an URL and returns an image.


url (str): The URL of the target website to be downloaded.

width (int): Width of the target image (default=1920)

height (int): Height of the target image (default=1080)

format (str): The format of the target image. Either png or jpg (default=png)

quality (int): JPEG Quality from 0 to 100 (default=60)

A bytestream containing the downloaded website as image
GET /version

API endpoint to retrieve version information of the service.


The Api endpoint can be queried as follows:

$ curl "localhost:5000/version"
$ curl "localhost:5000/version?format=json"
format (str): (Optional) when format=json a json object is returned
Version information of the service either as plaintext or json. Information contains version number, git hash (one commit behind) and git branch.
POST /login

Login the user using flask_jwt_extented. Accepts json as input and returns an access token. The configuration can be set via environment variables:

  • JWT_SECRET_KEY: The secret key for JWT
  • JWT_USER: The username of the JWT login. Default: user
  • JWT_PASSWORD: The password for the JWT login. Default: url2image
  • USE_LOGIN: Enables/Disables the requirement for login via JWT. Default: True
  • JWT_ACCESS_TOKEN_EXPIRES: The expiration time (in seconds) of False for no expiration of the JWT. Default: False

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"


username: The username to login

password: The users password

The generated access token.

Return “Hello World” as a default for the “/” route

Main file for the url2_image app

Module contents