taeram / idiocy

Idiocy is a Python powered URL shortening service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idiocy

Idiocy is a Python powered URL shortening service.

Requirements

You'll need the following:

Setup

Local development setup:

    # Clone the repo
    git clone https://github.com/taeram/idiocy.git

    cd ./idiocy/

    # Setup and activate virtualenv
    virtualenv .venv
    source ./.venv/bin/activate

    # Install the pip requirements
    pip install -r requirements.txt

    # Create the development database (SQLite by default)
    python manage.py database create

    # Start the application, prefixing with the required environment variables
    API_KEY="secret_api_key" python main.py

Usage

To shorten a URL, POST it to http://your-domain.com using your API key:

curl -X POST http://your-domain.com -H "Authorization: secret_api_key" -F "url=http://example.com/kitty.gif"

The body of the response will contain the shortened URL:

http://your-domain.com/oT0Dh

Some services will generate image previews of an image URL if it has the correct file extension. To enable this, simply add a file extension to the shortened URL:

http://your-domain.com/oT0Dh.gif

To remove a URL, simply DELETE it using its short URL:

curl -X DELETE http://your-domain.com/oT0Dh -H "Authorization: secret_api_key"

About

Idiocy is a Python powered URL shortening service.

License:MIT License


Languages

Language:Python 52.1%Language:HTML 43.9%Language:Shell 4.1%