Questions tagged [python-requests-toolbelt]
10 questions
                    
                    7
                    
            votes
                
                1 answer
            
        How to Upload a large File (≥3GB) to FastAPI backend?
I am trying to upload a large file (≥3GB) to my FastAPI server, without loading the entire file into memory, as my server has only 2GB of free memory.
Server side:
async def uploadfiles(upload_file: UploadFile = File(...):
Client side:
m =…
         
    
    
        Yuqi Wang
        
- 135
- 1
- 2
- 8
                    5
                    
            votes
                
                2 answers
            
        Pyrebase4 error cannot import name 'gaecontrib'
I have been trying to install pyrebase4 using pip install pyrebase4 but when ran it throws below error
"C:\Users\ChodDungaTujheMadhadchod\anaconda3\envs\sam_upgraded\lib\site-packages\requests_toolbelt\adapters\appengine.py", line 42, in … 
         
    
    
        Hack Try
        
- 471
- 4
- 17
                    1
                    
            vote
                
                0 answers
            
        How do I force HTTP connections to use IPv4 instead of IPv6 in Python?
When attempting to connect to the Binance REST API from a Windows 11 computer, I got the following error:
ccxt.base.errors.ExchangeError: binanceus {"code":-71012,"msg":"IPv6 not supported"}
In this particular example I am using the ccxt Python…
         
    
    
        arosca
        
- 469
- 7
- 15
                    0
                    
            votes
                
                0 answers
            
        requests_toolbelt: 415 Client Error: Unsupported Media Type
I am trying to upload file as follows:
from requests_toolbelt import MultipartEncoder
import requests
file_details = {'upload-type': 'gallary', 'username': 'a457'}
url = "url/to/upload"
with open('path/to/file', "rb") as file:
    encoder =…
         
    
    
        StaticName
        
- 239
- 1
- 2
- 10
                    0
                    
            votes
                
                0 answers
            
        Multipart upload wordpress REST API
I'm trying to upload audio files to a Wordpress site via the API. I'm using the requests_toolbelt for the multipart encoding. Here is my code:
import new_auth
import requests_toolbelt
import pathlib
class AudioFile:
    def __init__(self, File):
  …
         
    
    
        user1432738
        
- 101
- 1
- 5
                    0
                    
            votes
                
                1 answer
            
        Is it possible that posting with `requests` and `MultipartEncoder` results in bad transfer or partial upload?
When trying to upload a file using request.post and MultipartEncoder, is it possible that the upload is bad and results in inconsistency between the original file and the received file? Do I need to do any integrity or validity check?
         
    
    
        Richie F.
        
- 104
- 1
- 9
                    0
                    
            votes
                
                1 answer
            
        MultipartEncoder - requests_toolbelt
I try send a file to locust, but i need encode the request and, i use MultipartEncoder with this code:
multipart_data = MultipartEncoder(
            fields = {
                        "title": "test",
                        "description": "bar",
 …
         
    
    
        alejandro correa
        
- 157
- 2
- 12
                    0
                    
            votes
                
                1 answer
            
        Python file upload using request multipartencoder with json bdoy
I have the following python function where im trying to upload a file over to an API that accepts a file as multipart stream. The API correctly works with postman, however im struggling to identify the problem here.
I have parameters (json body) to…
         
    
    
        Aaditya Damani
        
- 355
- 1
- 2
- 12
                    0
                    
            votes
                
                1 answer
            
        How to encode string array as fieldin Python 3.7 using requests_toolbelt
In my request, I have an array with string values and numbers. Here is a simple example:
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
m = MultipartEncoder(
    fields={'field0': 'value', 'field1': ['Test1',…
         
    
    
        Mindaugas Jaraminas
        
- 3,261
- 2
- 24
- 37
                    0
                    
            votes
                
                1 answer
            
        How to encode data in Python 3.7 using requests_toolbelt
In my request, I have some Boolean values and numbers. Here is a simple example:
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
m = MultipartEncoder(
    fields={'field0': 'value', 'field1': True,
           …
         
    
    
        Mindaugas Jaraminas
        
- 3,261
- 2
- 24
- 37