-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
content type header is null #1469
Comments
Hi @timmyschweer, thanks for opening this issue! You should upload this as a file, rather than as a single giant data string. Try using: import requests
url = "http://127.0.0.1:8888/service/rest/project/27/uploadfile/filename.zip"
filepath = "/home/user/3gb-file.zip"
session = requests.Session()
session.trust_env = False
sessionauth = requests.auth.HTTPDigestAuth("user", "password")
files = {'file': open(filepath, 'rb')}
session.post(url, files=files, timeout=20) |
Hi @Lukasa, thank you for your reply =) |
Ah, ok. In that case we don't provide a |
@Lukasa i already tried that! then the boundary is missing =/ |
What are you setting the |
seems like the "org.apache.commons.fileupload" is not capable of receiving data this way ha? :'( |
Nah, it's that you're lying to it! =D You aren't sending |
@Lukasa thank you for your brain muscle action! Is there another way of using
without copying the file to memory? |
Re my brain: I'm always happy to help! It's what I'm here for. =) Unfortunately, in vanilla Requests the answer is simply no. Making this work is a fairly major diversion from how Requests works. If you wanted this to work you'd need to submit an improvement to It is not impossible that we'll consider this as part of our work on Requests 2.0, as it would certainly been an awesome feature. However, it's not in the immediate plan. Sorry. =( |
okay, would never have thought it would work that simple... Dependent on the mediatype I'm using the file upload multipart parser or directly writing the HTTP stream to disk. @Lukasa thx for your help! Here's my java restlet code:
|
using python requests to upload very large files to an java restlet that uses "org.apache.commons.fileupload" to receive the upload.
I checked the request header from the Response object, and there really is no "Content-Type" specified. I'm using the current requests library version 1.2.3 and python version 2.7.2
The text was updated successfully, but these errors were encountered: