Ejemplo n.º 1
0
  def test_normalized_uri(self):
    normalized_uri = 'http://www.thisis.me/hello'
    uri = normalized_uri + '?q=world'

    result = normalize_uri(uri)

    self.assertEqual(result, normalized_uri)
  def original_content_uri(self):
    entities = self.json.get('entities')
    if entities:
      urls = entities.get('urls')
      if urls:
        return normalize_uri(urls[0].get('expanded_url'))

    return None
Ejemplo n.º 3
0
def _normalize_uri(uri):
  # We should be using GET instead of HEAD because some servers don't redirect them the same.
  response = requests.get(uri, allow_redirects=True)
  return normalize_uri(response.url)
  def original_content_uri(self):
    uri = self.json.get('link')
    if uri:
      return normalize_uri(uri)

    return None