Skip to content

Url shortener with Bottlepy, Sqlalchemy, Gevent, Bootstrap, Jquery / Really dummy way.

License

Notifications You must be signed in to change notification settings

FZX/url-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Url-shortener Logo

URL-Shortener

URL-Shortener is simple service built using Bottlepy.

Url-shortener Logo

Used packages.

  • Bottlepy is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the Python Standard Library..
  • SqlAlchemy: as their site says SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL..
  • Bottle-SQLAlchemy: plugin integrates SQLAlchemy with Bottle application. It injects a SQLAlchemy session in route and handle the session cycle.
  • Gevent: gevent is a coroutine -based Python networking library that uses greenlet to provide a high-level synchronous API on top of the libev event loop.
  • Validators: Python Data Validation for Humans™.
  • Bootstrap: is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.
  • Jquery is a fast, small, and feature-rich JavaScript library.

You can access shrinked url stats at yourdomain.com/1/stats, yourdomain.com/2/stats and so on.

Url-shortener Logo

Example: Simple developer api

var request = $.ajax({
    url: "http://yoursite.com/api",
    method: "POST"
    data: {
        link: "http://github.com"
    },
    success: function(response){
        console.log(response.status);
        console.log(response.url);
    }
})

Post to api with jquery and you will get json object back with status and shrinked url.

import requests

data = {"link": "github.com"}
respond = requests.post("http://yoursite.com/api", params=data)
print(respond.text)

Post to api with requests module

Download and Setup

  • First you need to get this repository on your machine git clone https://github.com/FZX/url-shortener.git
  • Move to directory cd url-shortener
  • Install all necessary packages pip3 install -r requirements.txt .

* Change variable site to your address. Url-Shortener runs with Python 3.3+.

License

Code and documentation are available according to the GPL 3.0 License (see LICENSE).

The Url-Shortener logo however is NOT covered by that license. It is allowed to use the logo as a link to the Url-shortener page. In all other cases please ask first.

About

Url shortener with Bottlepy, Sqlalchemy, Gevent, Bootstrap, Jquery / Really dummy way.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages