IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

48 lignes
1.1KB

  1. from http.client import HTTPConnection, \
  2. HTTPSConnection
  3. from urllib.parse import urlparse
  4. def get(url, headers={}):
  5. url = urlparse(url)
  6. netloc = url.netloc.split(':')
  7. host = netloc[0]
  8. if url.scheme == 'https':
  9. conn = HTTPSConnection(netloc[0], netloc[1] \
  10. if len(netloc) > 1 else 443)
  11. else:
  12. conn = HTTPConnection(netloc[0], netloc[1] \
  13. if len(netloc) > 1 else 80)
  14. req = conn.request('GET', url.path + ('?' + url.query \
  15. if url.query else ''), headers=headers)
  16. resp = conn.getresponse()
  17. status, reason = resp.status, resp.reason
  18. if status == 200:
  19. return (status, reason, resp.read(), resp)
  20. else:
  21. return (status, reason, None, resp)
  22. class RegistryClient(object):
  23. def __init__(self, url):
  24. self.url = url
  25. def authAnon(self):
  26. get(url)
  27. def command_reg_search(args):
  28. raise NotImplementedError
  29. def command_reg_tags(args):
  30. raise NotImplementedError
  31. def command_reg_pull(args):
  32. raise NotImplementedError
  33. def command_reg_push(args):
  34. raise NotImplementedError