Demo entry 6783111



Submitted by anonymous on Jan 30, 2019 at 00:30
Language: Python 3. Code size: 493 Bytes.

#!/usr/bin/env python

# Import the modules

import bitlyapi
import sys

# Define your API information

API_USER = "your_api_username"
API_KEY = "your_api_key"

b = bitlyapi.BitLy(API_USER, API_KEY)

# Define how to use the program

usage = """Usage: python [url]
e.g python"""

if len(sys.argv) != 2:
    print usage

longurl = sys.argv[1]

response = b.shorten(longUrl=longurl)

print response['url']

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).