Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7669

Dynamic URL shortening

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <tyler@tysdomain.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:URL': 0.09; 'library': 0.15; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'inherit,': 0.16; 'message-id:@tysdomain.com': 0.16; 'metaclass': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds- solutions.net': 0.16; 'registry.': 0.16; 'reply-to:addr:tyler': 0.16; 'reply-to:addr:tysdomain.com': 0.16; 'shorten': 0.16; 'solution?': 0.16; 'input': 0.17; 'url:blog': 0.17; 'this?': 0.19; 'seems': 0.21; 'blog:': 0.22; 'all:': 0.23; "i'm": 0.27; 'developers.': 0.29; 'at.': 0.30; 'anyone': 0.32; 'someone': 0.33; 'to:addr:python-list': 0.33; 'handling': 0.33; 'project': 0.33; 'there': 0.35; 'header:User-Agent:1': 0.35; 'curious': 0.35; 'like:': 0.35; 'else': 0.35; 'quite': 0.36; 'something': 0.37; 'recently,': 0.37; 'data': 0.38; 'some': 0.38; 'url:google': 0.38; 'received:192': 0.38; 'skip:s 20': 0.39; 'user': 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'url:net': 0.63; 'enough,': 0.65; 'care,': 0.68; 'header:Reply-To:1': 0.72; 'reply- to:no real name:2**0': 0.72; 'website:': 0.75; 'viable': 0.84
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on wuff
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1
Date Tue, 14 Jun 2011 22:03:39 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version 1.0
To python-list@python.org
Subject Dynamic URL shortening
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To tyler@tysdomain.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.254.1308111005.11593.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 82.94.164.166
X-Trace 1308111005 news.xs4all.nl 49045 [::ffff:82.94.164.166]:57544
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7669

Show key headers only | View raw


Hello all:
I started working on a project with someone else quite recently, and he 
has a request. The project requires an URL shortener, and he would like 
it to be dynamic for both users and developers. Apparently some 
applications on the mac allow for the user to input some data on a URL 
shortener and use that specific service to shorten URLS. So I'm curious 
if anyone has had any experience with this in python/can recommend a 
library to look at.

Secondly, my requirement to make this dynamic for developers. The way I 
did this was to use a metaclass that the base URLShortener will inherit, 
which will add itself to a shortener registry. This works well enough, 
and all I really need to do is something like:
shortener = factory.getShortener("bitly")
url = shortener.shorten("http://google.com")
How viable is this solution? It seems like it's nice enough, are there 
other approaches to handling something like this?

-- 

Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Dynamic URL shortening "Littlefield, Tyler" <tyler@tysdomain.com> - 2011-06-14 22:03 -0600

csiph-web