How to write http response to a file
Write or append HTTP response text to a file in Python using the requests library.
For text response: use response.text
response = requests.get("https://api.github.com/users/saadjs")
with open("response.txt", "w") as f: # 'w' for write file permission
f.write(response.text)
To append to a file:
response = requests.get("https://api.github.com/users/saadjs")
with open("response.txt", "a") as f: # 'a' for append file permission
f.write(response.text)