Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkutaj/936814035f5a0db3df66ea9310b420a5 to your computer and use it in GitHub Desktop.
Save pkutaj/936814035f5a0db3df66ea9310b420a5 to your computer and use it in GitHub Desktop.
2023-07-21-How-to-Fix-422-Client-Error--Unprocessable-Entity-when-using-json-parameter-of-Request-Python-Module.md
Code Explanation
with open("temp_schema.json", mode="rt", encoding="utf-8") as patched_schema: Opens the file in read mode with UTF-8 encoding
schema_to_patch = patched_schema.read() Reads the contents of the file into a string
schema_patcher_http_requestor.make_iglu_request(...) Calls the make_iglu_request function
res = request_func(...) Makes an HTTP request using the requests library
json=schema_to_patch Passes the contents of the file as a string to the json parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment