title: Complete urls in Tweepy when expanded_url is not enough (integration with urllib2?)
body: <p>I have recently started to use Tweepy, in particular the api.user_timeline. My script downloads a series of tweets from users and prints to a text file most of the various details available in the Tweepy Status call. My problem is with reversing the tiny urls from twitter. I have read in an answer on this site that the correct way to address it would be to use the 'expanded_url' command within Twitter entities and that is what I did. Here is my code:</p>
  
  <pre><code>import tweepy
  import codecs
  
  
  auth = tweepy.OAuthHandler("xxx", "xxx")
  auth.set_access_token("yyy", "yyy")
  
  with codecs.open("file.txt", encoding='utf-8', mode='w+') as f:
     api = tweepy.API(auth)
     for status in tweepy.Cursor(api.user_timeline, "xxx", include_entities=True).items():
      ...
      # Extracting info from the entities
         for hashtag in status.entities['hashtags']:
             f.write(format(hashtag['text']))
  
  
         for url in status.entities['urls']:
             f.write(format(url['expanded_url']))
  </code></pre>
  
  <p>The problem is that these expanded urls are not always the full urls that I need. For example, the code in question for a tweet gave me as a result '<a href="http://goo.gl/sOH17n" rel="nofollow">http://goo.gl/sOH17n</a>' which still hides the true website the article is from. I have a snippet of code that gives me the complete url with urllib2 but when I put the two of them together, I get a <strong>'HTTPError: HTTP Error 403: Forbidden'</strong>. Here's my trial that DOES NOT WORK (it's always integrated with the part before, so it's not a problem of not going through authentication)</p>
  
  <pre><code>import urllib2
  for url in status.entities['urls']:
          expanded_url=url['expanded_url']
          fullurl= urllib2.urlopen(expanded_url)
          f.write(format(fullurl.url))
  </code></pre>
  
  <p>So, my question is, is there a way to find the TRULY complete urls within Tweepy? If not, why wouldn't the integration with urllib2 work? I apologize if the question seems trivial but I can't seem to find my way out of this one and tweepy's documentation is sketchy. </p>
  
  <p>Thanks in advance for any answer! </p>