Smurl from Python

22 September 2005   1 comment   Python

Mind That Age!

This blog post is 12 years old! Most likely, its content is outdated. Especially if it's technical.

Powered by Fusion×

If you thought the Web Service example on the about page of Smurl.name was complicated, here's a much simpler version. I use this code on my very own site for the email notifications which will contain long URLs.

Feel free to steal this code into your own projects:

from urllib import urlopen, quote

# variable 'url' is defined elsewhere
if len(url) > 80:
    url = urlopen('http://smurl.name/createSmurl?url=%s' % quote(url)).read()

Was that hard?

Follow @peterbe on Twitter

Comments

Tim Knapp
No
Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
Python regular expression tester 19 September 2005
Next:
Ruby and Python benchmarked 25 September 2005
Related by Keyword:
Announcing Smurl - a free URL compressor 07 September 2005
parametrize_url() adding parameters to URLs 14 January 2005
Related by Text:
Control comment spam 05 April 2005
All the Seinfeld quotes you can eat 08 March 2005
Yahoo! Inbound Links API 27 November 2005
God, No! by Penn Jillette 09 November 2014
Ability to embed HUGE pictures 18 November 2012