Skip to content

Taralas209/bitly-url-shortener-and-click-counter-dvmn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitly URL Shortener and Click Counter

This is a simple Python script that allows you to shorten URLs using Bitly and check the click count for existing Bitly links. The script uses the Bitly API to interact with the service.

Installation

To use this script, you need to have Python installed on your system. You can download the latest version of Python from the official website.

To install the required dependencies, run the following command:

pip install -r requirements.txt

Installation

To use this script, you need to have Python installed on your system. You can download the latest version of Python from the official website.

To install the required dependencies, run the following command:

pip install -r requirements.txt

Setup

  1. Create an account on Bitly and generate an access token from the API section in your account settings.
  2. Create a .env file in the same directory as the script, and add the following line:

BITLY_ACCESS_TOKEN=<your_access_token

Replace <your_access_token> with the access token you generated from Bitly.

Usage

To use the script, open a terminal or command prompt and navigate to the directory where the script is located.

To shorten a URL, run the following command:

python main.py --link <your_link_to_shorten>

Replace <your_link_to_shorten> with the URL you want to shorten.


To check the click count for an existing Bitly link, run the same command with the Bitly link:

python main.py --link <your_bitly_link>

Replace <your_bitly_link> with the Bitly link you want to check the click count for.

Dependencies

This script requires the following Python packages:

  • python-dotenv==1.0.0
  • requests==2.28.2

Project Goals

This code was written for educational purposes as part of an online course for web developers at dvmn.org.

About

Python script to shorten URLs and check click counts using Bitly API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages