easy copy headers from browser
Project description
copyheaders
方便的从浏览器复制headers
本项目是从https://github.com/scrapy/w3lib 修改过来的
为什么要修改请看https://github.com/scrapy/w3lib/issues/90
Sample Code
from copyheaders import headers_raw_to_dict
import requests
headers_raw = b"""Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8,zh-TW;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Cookie:_gauges_unique_year=1; _gauges_unique=1; _gauges_unique_hour=1; _gauges_unique_day=1; _gauges_unique_month=1
Host:httpbin.org
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"""
headers = headers_raw_to_dict(headers_raw)
# 然后就可以在requests中直接用了
z = requests.get('https://httpbin.org/',headers=headers)
Installation
pip install copyheaders
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
copyheaders-0.0.2.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file copyheaders-0.0.2.tar.gz
.
File metadata
- Download URL: copyheaders-0.0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1348079debbd54b81d6a10018c6d7fa336b302e14eaff7ff06fe0db23bf2aebd |
|
MD5 | 13f4e75c99a30e3eeb5c43bed3726df2 |
|
BLAKE2b-256 | 075b7dfb85fd610c00d44bb9a67dbdd87398c29f839fc98a10acd0153d856443 |
File details
Details for the file copyheaders-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: copyheaders-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4c79c187680d1a1e8fe9b007cb610690c5e9d6f2fb4d34784c10882033db8da |
|
MD5 | 77dc3b8db26df94772a4d6fc615f8352 |
|
BLAKE2b-256 | bc7a6406c9ac88e36a8bb4bd1cba28ca82835bd67717e89f138c5df3ee0268d9 |