一个基于AIOHTTP的Python REST客户端,用于Docker注册表。

docker-registry-client-async的Python项目详细描述


docker注册表客户端异步

概述

一个基于AIOHTTP的pythonrest客户端,用于Docker注册表。在

入门

importasyncioimportjsonfromdocker_registry_client_asyncimportDockerRegistryClientAsync,FormattedSHA256,ImageName,Manifestasyncdefget_config(drca:DockerRegistryClientAsync,image_name:ImageName,manifest:Manifest)->bytes:config_digest=FormattedSHA256.parse(manifest.get_json()["config"]["digest"])result=awaitdrca.get_blob(image_name,config_digest)returnjson.loads(result["blob"].decode("utf-8"))asyncdefget_manifest(drca:DockerRegistryClientAsync,image_name:ImageName)->Manifest:result=awaitdrca.get_manifest(image_name)returnresult["manifest"]asyncdefmain():image_name=ImageName.parse("busybox:1.30.1")asyncwithDockerRegistryClientAsync()asdrca:manifest=awaitget_manifest(drca,image_name)config=awaitget_config(drca,image_name,manifest)print(config)if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(main())

兼容性

  • 用python3.8测试

安装

pypi.org

^{pr2}$

源代码

$ git clone https://github.com/crashvb/docker-registry-client-async
$ cd docker-registry-client-async
$ virtualenv env
$ source env/bin/activate
$ python -m pip install --editable .[dev]

环境变量

VariableDefault ValueDescription
DRCA_CACERTSThe path to the certificate trust store.
DRCA_CHUNK_SIZE2097152The chunk size to use then replicating content.
DRCA_CREDENTIALS_STORE~/.docker/config.jsonThe credentials store from which to retrieve registry credentials.
DRCA_DEFAULT_REGISTRYindex.docker.ioThe default registry index to use when resolving image names.
DRCA_DEFAULT_NAMESPACElibraryThe default registry namespace to use when resolving image names.
DRCA_DEFAULT_TAGlatestThe default image tag to use when resolving image names.
DRCA_PROTOCOLhttpsThe default transport protocol to when communicating with a registry.
DRCA_TOKEN_BASED_ENDPOINTSindex.docker.io,quay.io,registry.redhat.ioEndpoints for which to retrieve authentication tokens.

发展

Source Control

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java解析一个文本文件,如果内容是一种特定的格式,就打印它   java如何使jbutton在另一个组件中执行键盘笔划   连接到独立帐户的java Stripe   java在数据库连接过程中出错。。。初始连接   一个系列JavaFX中特定节点的java集样式   java重建recycler视图会导致它消失   在codechef上提交java Getting runtime(NZEC)时出错   Java类路径设置错误   java如何显示数组中2个数字之间的信息?   java为什么新的GC只有很长的用户时间?   如何解决java。关于此代码的lang.OutOfMemoryError   通过应用程序在Facebook粉丝页面上发布java帖子   java Red5服务器无法启动   系统输出Java读取文本文件外置行   java整数。Parse对excel获取的字符串抛出NumberFormatException   有一个Java数组列表;如何按每个数组的最后一个元素排序?   java需要txt文件中的数据(以逗号分隔)来用现有类中的对象填充arraylist