femmerling / scarlett

http to https Image serving translator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SCARLETT

Translation service to convert http served image into https. Can be used to make sure you always serve image under HTTPS. Just make sure you host it behind a HTTPS domain.

This was actually part of Prism's service but being opensourced for reference implementation or learning purposes.

Feel free to use and modify

Requirements

  • Python3.6
  • Sanic
  • Requests

Installation

Install virtualenv if you haven't yet

$ xcode-select --install # Install Command Line Tools if not installed yet
$ sudo easy_install pip # If you haven't installed pip yet
$ sudo pip install virtualenv # If you haven't installed virtualenv yet

Install dependencies

$ virtualenv -p python3.6 env
$ source env/bin/activate
$ pip install -r requirements.txt

Run app

$ python serve.py

To run this with docker, the dockerfile is available inside the docker/ directory

Usage

Scarlett will download and serve any image file on the fly

use it by doing this

<host>/<image_url>

example: https://scarlett.example.com/https://originalhost.com/images/some/long/scheme/someimage.jpg

And voila it will display the image

Environment Variables

  • SCARLETT_DEFAULT_IMG the default image used when the url is not found

Testing

$ nosetests --cover-html --cover-erase --cover-package=scarlett --cover-erase --with-xcoverage -v tests

Contributors

@femmerling @tistaharahap @rifkyalikiki

About

http to https Image serving translator


Languages

Language:Python 76.5%Language:Shell 15.1%Language:Dockerfile 8.4%