
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
gen_browser_header create header for http(s) request, return a list like
[{
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8',
'Accept-Encoding': '',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Connection': 'keep-alive',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0'
},
{
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Accept-Encoding': '',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Connection': 'keep-alive',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
}
pip install gen-browser-header
import gen_browser_header.main.GenHeader as gen_header
import gen_browser_header.setting.Setting as setting
import gen_browser_header.self.SelfEnum as self_enum
cur_setting = setting.GbhSetting()
cur_setting.proxy_ip = ['10.11.12.13:8090']
cur_setting.browser_type = {self_enum.BrowserType.Chrome}
cur_setting.firefox_ver = {'min': 74, 'max': 75}
cur_setting.os_type = {self_enum.OsType.Win64}
cur_setting.chrome_type = {self_enum.ChromeType.Stable}
cur_setting.chrome_max_release_year = 1
print(gen_header(setting=cur_setting, num=10))
gen_browser_header use setting to pass related parameters into function , setting has below keys:
current year - 2008
, 2008 is the year that chrome releasedtype: str
default: None
description: In request header, there is a item Host. gen_browser_header generate this item base on this parameter.
For example, url 'https://packaging.python.org/tutorials/packaging-projects/' generate 'packaging.python.org'
type: int.
default: None.
description: how many header will be generate. if not set(default value is None), all
generate header will be return, otherwise, the num headers will be
return
0.1.0 use requests-html replace requests 0.1.3 add function extract_host_from_url; add item host in header
FAQs
A package to generate http(s) request header
We found that gen-browser-header demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.