匿名上传
如果您允许匿名用户上传测试结果(这是默认设置 IIRC),则相对容易。向上传的 dist 的 URL发出POST
请求,将tox
结果作为 JSON 有效负载传递。例子:
$ curl -i \
-H "content-type: application/json" \
-X POST \
--data-binary "@/tmp/toxreport.json" \
http://my-server/myuser/myindex/+f/19b/d3544d03b1716/mypkg-1.0.tar.gz
成功后,您应该得到类似于
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Content-Length: 143
Content-Type: application/json
Date: Wed, 08 Jan 2020 15:48:32 GMT
Server: waitress
X-Devpi-Api-Version: 2
X-Devpi-Master-Uuid: d800735d04a14c2d9bde920149cb8dbc
X-Devpi-Serial: 42
X-Devpi-Server-Version: 5.3.1
X-Devpi-Uuid: d800735d04a14c2d9bde920149cb8dbc
{
"result": "myuser/myindex/+f/19b/d3544d03b1716/mypkg-1.0.tar.gz.toxresult-20200108154832-0",
"type": "toxresultpath"
}
File
您可以在项目页面的文件表的列中找到目标 URL 。或者查询 JSON API 并过滤结果,例如
$ devpi getjson /myuser/myindex/mypkg | jq -r '[ .result[] | .["+links"][] | .href ]'
经过身份验证的上传
devpi
使用基本身份验证,因此只需在标头中传递 base64 编码的凭据Authorization: Basic
。例如,curl
再次:
$ curl -i \
--user myuser:mypass \
-H "content-type: application/json" \
-X POST \
--data-binary "@/tmp/toxreport.json" \
http://my-server/myuser/myindex/+f/19b/d3544d03b1716/mypkg-1.0.tar.gz
如果您需要有关测试上传身份验证的详细信息,请在此处查看我的其他答案。