0
votes

I wrote a simple python3 script for uploading files that runs in CLI. I using requests.post(somewebservice.com) for uploading files to server, but i want to add a progress bar to my script for tracking the progress of uploading. How I can find out state(percentage) of upload for use it in my progress bar?

If i know how to get that percentage or something like that, I can do threading things for parallel uploading and showing progress bar in CLI by myself.

Simple file uploading

payload = {'file': open(os.path.join(root, file), 'rb')}
response = requests.post("http://some-web.service.com:8000/upload",
                                             files=payload)
1

1 Answers

0
votes

Try tqdm package: https://pypi.org/project/tqdm/

from tqdm import tqdm
for i in tqdm(range(requests.ReadTimeout)):
    pass