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!
Browse Source

Started thinking about support for Docker registries.

master
parent
commit
317c782ac6
1 changed files with 47 additions and 0 deletions
  1. +47
    -0
      focker/pull.py

+ 47
- 0
focker/pull.py View File

@@ -0,0 +1,47 @@
from http.client import HTTPConnection, \
HTTPSConnection
from urllib.parse import urlparse
def get(url, headers={}):
url = urlparse(url)
netloc = url.netloc.split(':')
host = netloc[0]
if url.scheme == 'https':
conn = HTTPSConnection(netloc[0], netloc[1] \
if len(netloc) > 1 else 443)
else:
conn = HTTPConnection(netloc[0], netloc[1] \
if len(netloc) > 1 else 80)
req = conn.request('GET', url.path + ('?' + url.query \
if url.query else ''), headers=headers)
resp = conn.getresponse()
status, reason = resp.status, resp.reason
if status == 200:
return (status, reason, resp.read(), resp)
else:
return (status, reason, None, resp)
class RegistryClient(object):
def __init__(self, url):
self.url = url
def authAnon(self):
get(url)
def command_reg_search(args):
raise NotImplementedError
def command_reg_tags(args):
raise NotImplementedError
def command_reg_pull(args):
raise NotImplementedError
def command_reg_push(args):
raise NotImplementedError

Loading…
Cancel
Save