trying to make a program in python that request the following api and return with a QRcode. this QRcode i get back is actually formatted text and i need to put that into a PNG file. this is my code
import requests
import os
user = os.getlogin()
print("Hi there, " + user)
text = input("Enter a word: ")
request = requests.get("https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + text)
response = request.text
file = open("output.txt", "w")
file.write(response)
file.close()
print("\nDone !")
put i get this error when trying to save it as png or text:
'charmap' codec can't encode character '\ufffd' in position 0: character maps to <undefined>