Re: Dynamic URL shortening

2011-06-14 Thread Chris Angelico
On Wed, Jun 15, 2011 at 2:03 PM, Littlefield, Tyler  wrote:
> 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.

In my MUD client, RosMud, there's a URL shortener that's designed for
people playing a text RPG. The client itself isn't open source (but is
free to download), but the URL shortener is. It's all written in C++,
so it may not be of much use to you, but feel free to grab it from my
rather ugly web site: http://www.kepl.com.au/esstu/rosmud.html

The code is Windows-specific, but the TinyURL code is mostly just
network work, so by the time you've ported it to Python it will be
cross-platform.

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Dynamic URL shortening

2011-06-14 Thread Littlefield, Tyler

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!

--
http://mail.python.org/mailman/listinfo/python-list