Esempio n. 1
0
 def _parse_url(self, url):
     schma = '{}:'.format(self.schema)
     if '//' in url:
         schma, url1 = url.split('//')
     else:
         url1 = url
     domain, url2 = url1.split('/', 1)
     if not domain:
         return url
     elif schma + '//' + domain == self.domain:
         return '/' + url2
     else:
         raise exceptions.URLParseError()
Esempio n. 2
0
 def _get_uri_from_location(self, resp):
     link = resp.headers.get('Location')
     if not link:
         raise exceptions.URLParseError()
     return link