forked from streamlink/streamlink
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] plugin.api.http_session: remove parse_* methods(streamlink#4803)
The `parse_{cookies,headers,query_params}` methods were added when the subclass of `requests.Session` was implemented in order to support setting cookies, headers and query parameters via `k1=v1;k2=v2` strings (in addition to key-value dicts) via the session API and via the CLI: - 936e66d - c6e54fd Since these methods implement logic purely for the `Streamlink` session interface and are not meant to be called by any plugin or stream implementations which use the session's `HTTPSession` instance, they should be removed. Cookies, headers and query string parameters should be set directly on their respective `HTTPSession` attributes: - `cookies`: instance of `requests.cookies.RequestsCookieJar` - `headers`: instance of `requests.structures.CaseInsensitiveDict` - `params`: instance of `dict` Also, at least in regards to HTTP headers, the `key=value` syntax does not reflect the syntax of raw HTTP requests/responses or interfaces of other tools like cURL, etc., so having these methods on the `HTTPSession` class makes it unnecessarily confusing. The method names themselves are also confusing, as they suggest that the input gets parsed and that some result gets returned, which is wrong. This commit therefore moves the `k1=v1;k2=v2` string logic from the `http_session` module to the `session` module where it belongs and it also simplifies the option setter.
- Loading branch information
Showing
3 changed files
with
87 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters