mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
SessionOptions增加set_headers()
This commit is contained in:
parent
1ff632e147
commit
38b7a505ad
@ -8,10 +8,11 @@
|
|||||||
from configparser import RawConfigParser, NoSectionError, NoOptionError
|
from configparser import RawConfigParser, NoSectionError, NoOptionError
|
||||||
from http.cookiejar import Cookie
|
from http.cookiejar import Cookie
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any, Union
|
||||||
|
|
||||||
from requests.cookies import RequestsCookieJar
|
from requests.cookies import RequestsCookieJar
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
from typing import Any, Union
|
|
||||||
|
|
||||||
|
|
||||||
class OptionsManager(object):
|
class OptionsManager(object):
|
||||||
@ -357,6 +358,14 @@ class SessionOptions(object):
|
|||||||
"""
|
"""
|
||||||
self._max_redirects = max_redirects
|
self._max_redirects = max_redirects
|
||||||
|
|
||||||
|
def set_headers(self, headers: dict):
|
||||||
|
"""设置headers参数 \n
|
||||||
|
:param headers: 参数值
|
||||||
|
:return: 返回当前对象
|
||||||
|
"""
|
||||||
|
self._headers = {key.lower(): headers[key] for key in headers}
|
||||||
|
return self
|
||||||
|
|
||||||
def set_a_header(self, attr: str, value: str):
|
def set_a_header(self, attr: str, value: str):
|
||||||
"""设置headers中一个项 \n
|
"""设置headers中一个项 \n
|
||||||
:param attr: 设置名称
|
:param attr: 设置名称
|
||||||
|
Loading…
x
Reference in New Issue
Block a user