GithubHelp home page GithubHelp logo

fzx / url-shortener Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 815 KB

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

License: GNU General Public License v3.0

Python 100.00%
georgia python3 bottlepy sqlalchemy bootstrap jquery

url-shortener's Introduction

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.

url-shortener's People

Contributors

fzx avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.