def pull(server, secret, name):
    """
    Pull a blueprint from the secret and name on the configured server.
    """
    r = http.get('/{0}/{1}'.format(secret, name), server=server)
    if 200 == r.status:
        b = Blueprint.load(r, name)

        for filename in b.sources.itervalues():
            logging.info('fetching source tarballs - this may take a while')
            r = http.get('/{0}/{1}/{2}'.format(secret, name, filename),
                         server=server)
            if 200 == r.status:
                try:
                    f = open(filename, 'w')
                    f.write(r.read())
                except __HOLE__:
                    logging.error('could not open {0}'.format(filename))
                    return None
                finally:
                    f.close()
            elif 404 == r.status:
                logging.error('{0} not found'.format(filename))
                return None
            elif 502 == r.status:
                logging.error('upstream storage service failed')
                return None
            else:
                logging.error('unexpected {0} fetching tarball'.
                              format(r.status))
                return None

        return b
    elif 404 == r.status:
        logging.error('blueprint not found')
    elif 502 == r.status:
        logging.error('upstream storage service failed')
    else:
        logging.error('unexpected {0} fetching blueprint'.format(r.status))
    return None
dataset/ETHPy150Open devstructure/blueprint/blueprint/io/__init__.py/pull