文物是否支持部分文件上传?

发布于 2025-01-26 23:03:07 字数 850 浏览 1 评论 0原文

我正在工作一个 python 3 脚本,以从一大块数据(每个〜1MB)中下载数据(但可以在外部设置)。

下载的每个块必须上传到JFROG文物(JA)服务器(版本5.4.6,修订版50406900 )。

我正在使用HTTP标头'内容范围'来发送数据块。但是JA正在替换旧数据并仅保留最后一个块。 测试文件具有1164个字节,并且标头正确,测试块为512字节(仅测试,不需要大文件即可测试它)!

- BLK#1: bytes 0-511/1164
- BLK#2: bytes 512-1023/1164
- BLK#3: bytes 1024-1163/1164

注意:JA上的每个放置都通过http rc 201(创建)回答。

语法看起来还不错( https://developer.mozilla.org/pt-br/docs/web/http/headers/content-range-range )。

前两个块为512个字节,最后一个字节为140个字节。因此,我们得到了1164字节的文件。

我正在挖掘官方文档,但找不到答案。

  1. Jfrog Artifactory能够接收部分上传吗?

  2. 如果是这样,我该如何完成?

I'm working a Python 3 script to download data from a server in chunk of data (~1MB each, but can be setup externally).

Each block downloaded must be uploaded to a JFrog Artifactory (JA) server (version 5.4.6, revision 50406900).

I'm using the HTTP Header 'Content-Range' to send the data blocks. But the JA is replacing the old data and keeping only the last block.
The test file has 1164 byte and the header was sent right, with test block of 512 bytes (test only, no need big file to test it)!

- BLK#1: bytes 0-511/1164
- BLK#2: bytes 512-1023/1164
- BLK#3: bytes 1024-1163/1164

NOTE: Each PUT on JA was answered with a HTTP RC 201 (Created).

The syntax look all right (https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Headers/Content-Range).

The first two blocks was 512 bytes long and the last one with 140 bytes. So we got the 1164 bytes of file.

I'm digging through the official documentation, but haven't been able to find a answer.

  1. Does JFrog Artifactory able to receive partial uploads?

  2. If so, how I can acomplish it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉睡月亮 2025-02-02 23:03:07

我想出了一种解决jfrog文物在部分上传大文件的烦人失败的方法

我刚刚创建了一个io.rawiobase的继承类,一个python 3的基类。经过一些测试,我得到了必须实现的基本方法列表。

class MemoryFile(io.RawIOBase):

只需使用基本用法示例代码进行测试:

# Each side must have a session to avoid issues
downReq = requests.Session()
# Here the request with all security tokens and required params (I'm ignoring SSL check for test)
response = downReq.get(urlTargetFile,stream=True, verify=False)
# My custom class take a Response as constructor argument
fpIn = MemoryFile(response)

# Another session to upload the date
upReq = requests.Session()
# Call the JFrog Artifactory address 
upResp = upReq.put(urlUp, data=fpIn , headers=headers, verify=False, stream=True)
# The SHA-256 hash to save into Audit Log
print("SHA-256: ", fp.hash())

I figured out a way to solve the JFrog Artifactory annoying failure on partial upload of big files.

I just created a inherited class of the io.RawIOBase, a base class of Python 3. After a few tests I got the list of basic methods which I must implement.

class MemoryFile(io.RawIOBase):

Just get the test with a basic usage sample code:

# Each side must have a session to avoid issues
downReq = requests.Session()
# Here the request with all security tokens and required params (I'm ignoring SSL check for test)
response = downReq.get(urlTargetFile,stream=True, verify=False)
# My custom class take a Response as constructor argument
fpIn = MemoryFile(response)

# Another session to upload the date
upReq = requests.Session()
# Call the JFrog Artifactory address 
upResp = upReq.put(urlUp, data=fpIn , headers=headers, verify=False, stream=True)
# The SHA-256 hash to save into Audit Log
print("SHA-256: ", fp.hash())
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文