Skip to content

Instantly share code, notes, and snippets.

View mityukov's full-sized avatar

Vladimir Mityukov mityukov

  • Individual Entrepreneur
  • Ulyanovsk, Russia
  • X @pilat
View GitHub Profile
@Vopaaz
Vopaaz / Chrome-header-for-Python-requests.py
Last active November 7, 2023 09:50
Converting the directly copied header from Chrome to the header dict that can be used in requests package.
def parse_header(raw_header: str):
header = dict()
for line in raw_header.split("\n"):
if line.startswith(":"):
a, b = line[1:].split(":", 1)
a = f":{a}"
else:
a, b = line.split(":",1)