Easily build powerful user management, authentication, and authorization into your web and mobile applications.Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.
Using Python to shorten a URL with Google's shortening service (goo.gl):
# Corey Goldberg - 2010
gurl = 'http://goo.gl/api/url?url=%s' % urllib.quote(url)
req = urllib2.Request(gurl, data='')
results = json.load(urllib2.urlopen(req))
if __name__ == '__main__':
You give it a URL to shorten: shorten('http://www.goldb.org/long_url')
... and it returns a shortened URL for you: 'http://goo.gl/jh4W'
The Web Dev Zone is brought to you by Stormpath—offering a complete, pre-built User Management API for building web and mobile applications, and APIs. Download our new whitepaper: "Build Versus Buy: Customer Identity Management for Web and Mobile Applications".
Published at DZone with permission of
, DZone MVB
Opinions expressed by DZone contributors are their own.