Lukasa / requests-ftp

An FTP transport adapter for use with the Python Requests library.
Other
68 stars 25 forks source link

ValueError: invalid literal for int() with base 10: '226-Options:' #34

Open hknyldz opened 6 years ago

hknyldz commented 6 years ago

import requests import requests_ftp requests_ftp.monkeypatch_session() s = requests.Session() resp = s.list('ftp://host/', auth=('user', 'password')) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/site-packages/requests_ftp/ftp.py", line 25, in list return self.request('LIST', url, kwargs) File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 508, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 618, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3.6/site-packages/requests_ftp/ftp.py", line 182, in send resp = self.func_table[request.method](path, request) File "/usr/lib/python3.6/site-packages/requests_ftp/ftp.py", line 245, in list response = build_text_response(request, data, code) File "/usr/lib/python3.6/site-packages/requests_ftp/ftp.py", line 97, in build_text_response return build_response(request, data, code, 'ascii') File "/usr/lib/python3.6/site-packages/requests_ftp/ftp.py", line 116, in build_response response.status_code = int(code.split()[0]) ValueError: invalid literal for int() with base 10: '226-Options:'

dashea commented 6 years ago

The issue is with multi-line responses. This is fixed in master, see 4f6a9f5e34ba0b8fa14403de9b8e01316c220b0a