[英]Uploading text file to jFrog artifactory with python requests
我編寫了簡短的代碼片段來處理請求和工件。 我正在嘗試上傳一個簡單的文本文件。
import requests
url = "https://myurl.jfrog.io/artifactory"
auth = ("myusername", "mypassword")
file_name = "test.txt"
response = requests.put(url + "/data/" + file_name, auth=auth, data=open(file_name, "rb"))
print(response.status_code)
我收到錯誤代碼 405,我做錯了什么? 幾乎沒有使用請求處理工件的示例
指定的請求似乎被重定向到https://myurl.jfrog.io/artifactory/data/ <file_name> 這不是 Artifactory 實例中的實際存儲庫。
405 響應代碼(“方法不支持”)給出了很好的提示。
嘗試在 Artifactory 中創建一個存儲庫並將其附加到 /artifactory 之后,因此它應該是:
https://myurl.jfrog.io/artifactory/ <repository_key>/data/<file_name>
請在 REST API 文檔中找到更多信息: https ://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-DeployArtifact
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.