'Error when uploading a file to the cloud anonfile

I have a problem when sending anon files to the cloud, here is my code:

from anonfile import AnonFile
import getpass
import os
import os.path        

USER_NAME = getpass.getuser() 
dirr = os.getcwd()
a = "u"
anon = AnonFile()

upload = anon.upload('C:/WormTFEL/report.txt', progressbar=False)
print(upload.url.geturl('https://api.anonfiles.com/upload/?token='))

P.S: The token is specified correctly in the script, I erased it only here

Error:

                                                                   ←[0m| 0.00/0.00 [00:00<Upload: report.txt: 100%|←[32m○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○←[0m| 186/186 [00:00<00:00,Upload: report.txt: 100%|←[32m○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○←[0m| 186/186 [00:05<00:00, 35.2B/s]←[0m Traceback (most recent call last):  File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)   File "<string>", line 3, in raise_from   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1347, in getresponse
    response.begin()   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 336, in _raise_timeout
    raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.anonfiles.com', port=443): Read timed out. (read timeout=5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "c:\WormTFEL\anontest.py", line 11, in <module>
    upload = anon.upload('C:/WormTFEL/report.txt', progressbar=True)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\anonfile\anonfile.py", line 298, in upload
    response = self.session.post(   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(   File "C:\Users\Саня\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 511, in increment
    total -= 1 TypeError: unsupported operand type(s) for -=: 'tuple' and 'int'

Please help me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source