index.py 418 B

123456789101112131415
  1. from pip._vendor.six.moves.urllib import parse as urllib_parse
  2. class Index(object):
  3. def __init__(self, url):
  4. self.url = url
  5. self.netloc = urllib_parse.urlsplit(url).netloc
  6. self.simple_url = self.url_to_path('simple')
  7. self.pypi_url = self.url_to_path('pypi')
  8. def url_to_path(self, path):
  9. return urllib_parse.urljoin(self.url, path)
  10. PyPI = Index('https://pypi.org/')