0

This code executes properly and output in terminal/cmd/VScode is good [Devanagari]. but when I try to save it like demo.py>test.json this 'charmap' codec can't encode characters in position 150-153: character maps to error present in that file.

enter image description here

import requests

headers = {
  'Accept-Encoding': 'gzip, deflate',
  'User-Agent': 'okhttp/5.0.0-alpha.2'
    }
i = "680"
url = "https://example.com/get/demo_id?id="+str(i)

try:
    response = requests.request("GET", url, headers=headers) 
    print(response.text)
except Exception as e: print(e)
Amit kumar
  • 151
  • 1
  • 4
  • 20

0 Answers0