Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 181115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:42:17+00:00 2026-05-11T14:42:17+00:00

I am just learning python and is interested in how this can be accomplished.

  • 0

I am just learning python and is interested in how this can be accomplished. During the search for the answer, I came across this service: http://www.longurlplease.com

For example:

http://bit.ly/rgCbf can be converted to:

http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place

I did some inspecting with Firefox and see that the original url is not in the header.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:42:18+00:00Added an answer on May 11, 2026 at 2:42 pm

    Enter urllib2, which offers the easiest way of doing this:

    >>> import urllib2 >>> fp = urllib2.urlopen('http://bit.ly/rgCbf') >>> fp.geturl() 'http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place' 

    For reference’s sake, however, note that this is also possible with httplib:

    >>> import httplib >>> conn = httplib.HTTPConnection('bit.ly') >>> conn.request('HEAD', '/rgCbf') >>> response = conn.getresponse() >>> response.getheader('location') 'http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place' 

    And with PycURL, although I’m not sure if this is the best way to do it using it:

    >>> import pycurl >>> conn = pycurl.Curl() >>> conn.setopt(pycurl.URL, 'http://bit.ly/rgCbf') >>> conn.setopt(pycurl.FOLLOWLOCATION, 1) >>> conn.setopt(pycurl.CUSTOMREQUEST, 'HEAD') >>> conn.setopt(pycurl.NOBODY, True) >>> conn.perform() >>> conn.getinfo(pycurl.EFFECTIVE_URL) 'http://webdesignledger.com/freebies/the-best-social-media-icons-all-in-one-place' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just reading through Learning Python by Mark Lutz and came across this
I have just started learning Python & have come across namespaces concept in Python.
I'm learning python using the tutorial on the official python website and came across
I am currently learning python coding and I come across this qns on a
I am learning Python for a class now, and we just covered tuples as
I'm interested in learning some python, and thought Pylons would be a good starting
I'm just starting out learning python (for webapp usage) but I'm confused as to
I am learning Python now, and today, I met a problem in http://docs.python.org/release/2.5.4/tut/node8.html 6.1.1
I'm new to this site, and new to Python. So I'm learning about Regular
I'm just learning Python & Django. (Thanks to everyone who contributes here -- it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.