Skip to content

A simple url-shortner built using flask and bitly api.

License

Notifications You must be signed in to change notification settings

zootedb0t/url_shortner

Repository files navigation

URL Shortener App GitHub CodeQL Pylint

A url-shortner built using flask and Bitly api. It has following dependencies:

  • Flask - Core dependency
  • SQLAlchemy - For working with database
  • requests - For sending GET and POST request
  • PyQRCode - For generating QR code of URL

For using bitly api go to Bitly website and get a free account to get authentication key and group id. Use these credentials in the applications.

To find out guid for your account. Make a GET request to https://api-ssl.bitly.com/v4/groups you can use Postman, Curl, Node or Python request module.

While making request pass your Authorization token to header. In curl you can do this

curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups

This returns a json object containing guid. For more info

Running App Locally

  • Clone the repo:
git clone https://github.com/zootedb0t/url_shortner && cd url_shortner
  • Create a python virtual environment:
python -m venv venv
  • Activate virtual environment:
source venv/bin/activate
  • Install required modules:
pip install -r requirements.txt
  • Run app:
flask run

App in action

App home page

Screenshot_2023-02-09-09-15-41_1920x1080

Add Api Keys

Screenshot_2023-02-09-09-18-09_1920x1080

User database containing urls

Screenshot_2023-03-24-01-54-00_1920x1080

Short-URL generated through api

Screenshot_2023-03-17-11-46-59_1920x1080

Short-URL QR Code

Screenshot_2023-03-17-11-43-27_1920x1080