构建身份验证扩展
p01.buildouthttp的Python项目详细描述
一个用于构建的http插件,这个扩展可以定义受密码保护的包目录,而不必在/>url.
让我们以受保护的位置为例,``http://www.example.com/dist``
>首先,我们需要为受保护的位置添加扩展名和查找链接::
[buildout]
find link s=http://www.example.com/dist
extensions=p01.buildouthttp
然后创建`.httpauth``密码文件,该文件包含所有
身份验证信息。".httpauth"文件可以放在
当前buildout的根目录或"`~/.buildout"目录中。每一行由
``领域,uri,username,password``.
这里是`.httpauth``文件的示例:
example com领域,http://www.example.com,username,secret
然后,每当运行buildout时,都会提示您输入
秘密::
example com realm,http://www.example.com,username
请注意,basic auth也可以与使用
zc.buildout.download(例如hexagonit.recipe.download)的任何配方一起使用,因为这个
扩展也会覆盖s是zc.buildout的url打开程序。
github private downloads
==
=http://github.com/上的private downloads需要授权才能下载。
以前基于v2 api的基于令牌的身份验证系统(请参见http://github.com/blog/170-token-a从2012年6月1日起,
github不再支持验证;您现在必须请求一个v3 api令牌,并使用它来代替它。
-d'{"scopes":["repo"],"note":"my api token"}'\
https://${user}:${pass}@api.github.com/authorizations;grep token
现在将github.token的值设置为从上面的命令返回的散列:
git config--global github.accesstoken${token}
v3 api不需要您的github用户名,如果您愿意,可以从配置中删除它。
有关管理授权github的oauth令牌的详细信息,请参阅api
文档:http://developer.github.com/v3/oauth/\oauth authorization s api
下载标记或分支:
https://api.github.com/repos/<;gituser>;/<;repos>;/tarball/master
downlad a"download"的URL:
pypi上的一些鸡蛋也使用公共github下载如果提供了错误的auth
详细信息,您可能希望
白名单所需的repo,因为github将
返回401错误代码,即使对于公共存储库也是如此。
为此,只需按格式列出每个repo`<;gituser>;/<;repos>;`one per
line in构建配置"github repos"::
[buildout]
extensions=p01.buildouthttp
github repos=p01/repos
bitly/asyncMongo
credits
=
Mason,用于错误修复和扩展。
===========
handler安装
==============
>默认情况下,安装函数在
~/.buildout/.httpauth处查找密码文件并安装基本的身份验证打开程序。
找不到e。
>;>import os
>;>from p01.buildouthttp.buildouthttp import install
>;>install()
>>>>安装(pwd_path='a')
g')
>;>f.close()
>;>install(pwd_path=fp)
回溯(最后一次调用):
…
运行时错误:无法分析身份验证文件…pwd.txt:1
一些工作示例。
>;f=open(fp,'w')
>;=f.write('the realm,https://example.com/,username,password')
>;>;f.close()
>;>;install(pwd_path=fp)
>;>;f=open(fp,'w')
>;&u=f.write('the realm,https://example.com/,username,password\n\n')
>;>;f.close()
>;>;安装(pwd路径=fp)
>;>;f=打开(fp,'w')
>;>;&uu=写(''
>;>;f.关闭()
>;>;安装(pwd路径=fp)
ldout_dir=os.path.join(tmp,"test buildout")
>;>os.mkdir(buildout_dir)
>;>buildout={'buildout':{'directory':buildout_dir}
>;>install(buildout=buildout)
>;>buildout_fp=os.path.join(buildout_dir,'.httpauth')
>;>;>;f=open(buildout"fp,'w')
>;>;&u=f.write('the realm,https://example.com/not valid')
>;>;f.close()
>;>;install(buildout=buildout)
回溯(最近一次调用时间):
…
运行时错误:身份验证文件不能是解析…无:1
>;>f=open(buildout"fp,'w')
>;>f.write('the realm,https://example.com/,username,password')
>;>f.close()
>;>install(buildout=buildout)
目录。
>;>f=open(fp,'w')
>;>f.write('the realm,https://example.com/,username,password')
>;>f.close()
>;>install(buildout=buildout,pwd\u path=fp)
unload externsion:
>;>from p01.buildouthttp.buildouthttp import unload
>;>unload()
=
=
更改
=
<1.0.1(2015-11-27)
----
-错误修复:修复URL打开程序设置
1.0.0(2015-11-23)
----
在Python2.7.10和zc.buildout>;2.2上编辑
让我们以受保护的位置为例,``http://www.example.com/dist``
>首先,我们需要为受保护的位置添加扩展名和查找链接::
[buildout]
find link s=http://www.example.com/dist
extensions=p01.buildouthttp
然后创建`.httpauth``密码文件,该文件包含所有
身份验证信息。".httpauth"文件可以放在
当前buildout的根目录或"`~/.buildout"目录中。每一行由
``领域,uri,username,password``.
这里是`.httpauth``文件的示例:
example com领域,http://www.example.com,username,secret
然后,每当运行buildout时,都会提示您输入
秘密::
example com realm,http://www.example.com,username
请注意,basic auth也可以与使用
zc.buildout.download(例如hexagonit.recipe.download)的任何配方一起使用,因为这个
扩展也会覆盖s是zc.buildout的url打开程序。
github private downloads
==
=http://github.com/上的private downloads需要授权才能下载。
以前基于v2 api的基于令牌的身份验证系统(请参见http://github.com/blog/170-token-a从2012年6月1日起,
github不再支持验证;您现在必须请求一个v3 api令牌,并使用它来代替它。
-d'{"scopes":["repo"],"note":"my api token"}'\
https://${user}:${pass}@api.github.com/authorizations;grep token
现在将github.token的值设置为从上面的命令返回的散列:
git config--global github.accesstoken${token}
v3 api不需要您的github用户名,如果您愿意,可以从配置中删除它。
有关管理授权github的oauth令牌的详细信息,请参阅api
文档:http://developer.github.com/v3/oauth/\oauth authorization s api
下载标记或分支:
https://api.github.com/repos/<;gituser>;/<;repos>;/tarball/master
downlad a"download"的URL:
pypi上的一些鸡蛋也使用公共github下载如果提供了错误的auth
详细信息,您可能希望
白名单所需的repo,因为github将
返回401错误代码,即使对于公共存储库也是如此。
为此,只需按格式列出每个repo`<;gituser>;/<;repos>;`one per
line in构建配置"github repos"::
[buildout]
extensions=p01.buildouthttp
github repos=p01/repos
bitly/asyncMongo
credits
=
Mason,用于错误修复和扩展。
===========
handler安装
==============
>默认情况下,安装函数在
~/.buildout/.httpauth处查找密码文件并安装基本的身份验证打开程序。
找不到e。
>;>import os
>;>from p01.buildouthttp.buildouthttp import install
>;>install()
>>>>安装(pwd_path='a')
g')
>;>f.close()
>;>install(pwd_path=fp)
回溯(最后一次调用):
…
运行时错误:无法分析身份验证文件…pwd.txt:1
一些工作示例。
>;f=open(fp,'w')
>;=f.write('the realm,https://example.com/,username,password')
>;>;f.close()
>;>;install(pwd_path=fp)
>;>;f=open(fp,'w')
>;&u=f.write('the realm,https://example.com/,username,password\n\n')
>;>;f.close()
>;>;安装(pwd路径=fp)
>;>;f=打开(fp,'w')
>;>;&uu=写(''
>;>;f.关闭()
>;>;安装(pwd路径=fp)
ldout_dir=os.path.join(tmp,"test buildout")
>;>os.mkdir(buildout_dir)
>;>buildout={'buildout':{'directory':buildout_dir}
>;>install(buildout=buildout)
>;>buildout_fp=os.path.join(buildout_dir,'.httpauth')
>;>;>;f=open(buildout"fp,'w')
>;>;&u=f.write('the realm,https://example.com/not valid')
>;>;f.close()
>;>;install(buildout=buildout)
回溯(最近一次调用时间):
…
运行时错误:身份验证文件不能是解析…无:1
>;>f=open(buildout"fp,'w')
>;>f.write('the realm,https://example.com/,username,password')
>;>f.close()
>;>install(buildout=buildout)
目录。
>;>f=open(fp,'w')
>;>f.write('the realm,https://example.com/,username,password')
>;>f.close()
>;>install(buildout=buildout,pwd\u path=fp)
unload externsion:
>;>from p01.buildouthttp.buildouthttp import unload
>;>unload()
=
=
更改
=
<1.0.1(2015-11-27)
----
-错误修复:修复URL打开程序设置
1.0.0(2015-11-23)
----
在Python2.7.10和zc.buildout>;2.2上编辑