Deploying to artifactory via python script
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 above script to pipe it through py2exe, so external libraries can create problems.
In all my research, I've found that this is one way, but I don't know how to "translate" it to 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 this in Python? Or is it any way to deploy?
+3
source to share
2 answers
Tried it all day long and I had successful 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 problem with that.
+2
source to share