Created
March 25, 2022 01:40
-
-
Save x-N0/7c5de77f9849156c4cd5f4abde46a3bd to your computer and use it in GitHub Desktop.
Browser Headers to Dict PYTHON
This file contains hidden or 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
def raw_headers_to_dict(raw:str)->dict: | |
header_dict = {} | |
header_list = raw.split('\n') | |
for each in header_list: | |
key, value = each.split(': ') | |
header_dict.update({f"{key}": f"{value}"}) | |
return header_dict | |
# Usage: | |
dict_headers = raw_headers_to_dict(raw_headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment