We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
response headers like this:
Content-Disposition:attachment;filename*=charset'lang'value
In my script, temporarily use the custom method to hook function stream._get_filename.
stream._get_filename
from requests_toolbelt.downloadutils import stream def _get_filename(content_disposition): _QUOTED_STRING_RE = r'"[^"\\]*(?:\\.[^"\\]*)*"' _OPTION_HEADER_PIECE_RE = re.compile( r';\s*(%s|[^\s;=]+)\s*(?:=\s*(%s|[^;]+))?\s*' % (_QUOTED_STRING_RE, _QUOTED_STRING_RE) ) for match in _OPTION_HEADER_PIECE_RE.finditer(content_disposition): k, v = match.groups() if k == 'filename': # ignore any directory paths in the filename return os.path.split(v)[1] if k == 'filename*': return unquote(v).split('\'\'')[1] return None stream._get_filename = _get_filename
Expect to fix this issue
The text was updated successfully, but these errors were encountered:
No branches or pull requests
response headers like this:
In my script, temporarily use the custom method to hook function
stream._get_filename
.Expect to fix this issue
The text was updated successfully, but these errors were encountered: