Skip to content

sathy1dev/url_shortner_using_tinyurl---api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

WELCOME

To create an short url using "Tinyurl api" first we have to understand , how we can achieve this.

STEPS

  • We have to add our url next to the link (https://tinyurl.com/api-create,php?).
  • Then we have to access the link and get the response from the api and store it is a variable.
  • Then we read the variable and decode it.
  • We encode the url to make it easily understandable by the browsers.
  • Finally we print the shortened url.

CODE

MODULES

First we import necessary modules and libraries

  • We use future to tell interpreter that this function is compatible with both feature and past versions of python.
  • To encode our url we use urlencode
  • To open our url we use urlopen
  • To access python context manager we use contextlib
  • To access system arguments we use sys
from  __future__  import with_statement
from urllib.parse import urlencode
from urllib.request import urlopen
import contextlib
import sys

About

Create a instant short url for all your url needs using tinyurl's api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages