Generate a short bitly url from parameters in a file


Given a file with UTM tags, a domain, and a bitly preferred domain, do a script that converts each of these parameters into a long url and request a short url from bitly within the preferred subdomain. Then return a file with the original information plus the results from each request.

Technical Requirements:

Python 3.7.0

Use Virtual Env and export dependencies when delivering

Configuration Parameters:

Bitly API Key: The script should have a variable that it receives when being ran representing a Bitly api key. Create a test one for free and use it for your development.


(Optional) A Column for each UTM Tag that will be added. Columns are:






(Optional) 6 columns so the name of other three parameters along with their values can also be added to the long url



Same for Param_2 and Param_3

(Required) A url to which the parameters should be attached.

(Optional) Bitly’s preferred domain to do shortening (Eg: domain - (optional) the short domain to use; either [login to view URL], [login to view URL], or [login to view URL] or a custom short domain. The default for this parameter is the short domain selected by each user in their bitly account settings. Passing a specific domain via this parameter will override the default settings)

Script Functionality:

The script should read the input CSV and for each row, construct the domain and the url that will be sent to Bitly. The result of this process will be a long url. The long url should contain the domain, follow by the utm tags with their values, followed by the additional 3 parameters with their values if they exist.

Then, the script will go through each long url and do a request to Bitly and retrieve a short url for each using the preferred subdomain. Please read Bitly’s documentation on how to do this request here: [login to view URL] The script should respect the Bitlys quota so it won’t fail.

Finally, the script will gather the responses and return a file that contains the same columns as before, but additionally will add the columns stated in the output section.


Long URL:


Bitly Data:

new_hash - designates if this is the first time this long_url was shortened by this user. The return value will equal 1 the first time a long_url is shortened. It will also then be added to the user history.

url - the actual Bitlink that should be used, and is a unique value for the given Bitly account.

hash - a bitly hash for long_url which is unique to the given account.

global_hash - a bitly hash for long_url which can be used to track aggregate stats across all Bitlinks that point to the same long_url.

long_url - an echo back of the longUrl request parameter. This may not always be equal to the URL requested, as some URL normalization may occur (e.g., due to encoding differences, or case differences in the domain). This long_url will always be functionally identical the the request parameter.

Error Message: An error message for each url if present.

Error Code: An error code that bitly returned if present.

Constraints and Requirements:

If a UTM parameter is not present, the script should not fail.

If the extra parameters 1,2, or 3 are not present, the script should not fail.

Any other optional parameter should not make the script fail if not present.

If a required parameter is missing, for any of the urls, the script should stop before processing the urls and inform the user.

The script should be able to convert at least 1000 URLs continuously.

If one of the rows generates an error, the script should continue and an error column should be filled indicating what happened with that row.

Example files

You will find a file attached called [login to view URL] which will contain a sample file that should be converted.

You will find an [login to view URL] which will contain a sample file of the output the script should generate.

Unit Tests for functionality

Skills: API, Python, RESTful, Software Development, Testing / QA

See more: bitly api reference, bitly enterprise api, short url api, bitly api guide, bitly doc, bitly url length, create short link, custom short url, generate short url joomla, eclipse smartgwt url parameters php file, convert short file names long file names, display url parameters sample, url video file converter, url parameters magento, youtube url upload file, php dinamic content based url parameters, hide url parameters j2ee, smarty plugin generate short description, asp read url txt file, use url parameters display html

About the Employer:
( 24 reviews ) Glen Allen, United States

Project ID: #17348886

Awarded to:


Hey, I've read through your specification and feel I have a good understanding of your requirements. I've worked on similar scripts in the past and am experienced in Python. I'd be happy to help you with this, drop More

$30 USD in 2 days
(1 Review)

3 freelancers are bidding on average $30 for this job

$35 USD in 1 day
(30 Reviews)

A very interested task! Though I'm a new freelance here, I'm a Python evangelist with more than 4 years of experience. Clean code, comments, unit tests. Contact me and we will discuss the details if you are interested. More

$25 USD in 2 days
(0 Reviews)