I am trying to create a python script that can deploy an artifact to Artifactory. I am using Python 3.4 and I want the resulted script to put it through py2exe, so external libraries might create issues.
我正在尝试创建一个可以将工件部署到Artifactory的python脚本。我正在使用Python 3.4,我希望结果脚本通过py2exe,因此外部库可能会产生问题。
Through all my research, I found that one way is this, but I don't know how to "translate" it to Python:
通过我的所有研究,我发现有一种方法,但我不知道如何将它“翻译”为Python:
curl -X PUT -u user:password --data-binary @/absolute/path/my-utils-2.3.jar "http://localhost/artifactory/my-repo/my/utils/2.3/"
How can I achieve that into Python? Or is it any either way for deploying?
我怎样才能在Python中实现这一目标?或者它是否可以采用任何一种方式进行部署?
2 个解决方案
#1
2
Been trying the whole day and I've had some succesfull testing using the requests library.
一直在尝试,我已经使用请求库进行了一些成功的测试。
import requests
url = "repo/path/test.txt"
file_name = "test.txt"
auth=(USERNAME, PASSWORD)
with open(file_name, 'rb') as fobj:
res = requests.put(url, auth=auth, data=fobj)
print(res.text)
print(res.status_code)
And py2exe had no issues with it.
并且py2exe没有问题。
#2
1
You might want to take look at Party, either look on how they do it, or just use it directly.
你可能想看看Party,看看他们是怎么做的,或者直接使用它。
#1
2
Been trying the whole day and I've had some succesfull testing using the requests library.
一直在尝试,我已经使用请求库进行了一些成功的测试。
import requests
url = "repo/path/test.txt"
file_name = "test.txt"
auth=(USERNAME, PASSWORD)
with open(file_name, 'rb') as fobj:
res = requests.put(url, auth=auth, data=fobj)
print(res.text)
print(res.status_code)
And py2exe had no issues with it.
并且py2exe没有问题。
#2
1
You might want to take look at Party, either look on how they do it, or just use it directly.
你可能想看看Party,看看他们是怎么做的,或者直接使用它。