original_docstring: 
          This is a convenience method to handle api responses
          :param response:
          :param print_response:
          :return:
          
docstring: This is a convenience method to handle api responses
docstring_tokens: This is a convenience method to handle api responses
code: def handle_api_response(response: requests.Response):
          """
          This is a convenience method to handle api responses
          :param response:
          :param print_response:
          :return:
          """
          parsed_response = response.json()
          DCatAPI.logger_api_resp.debug("API Response: %s", parsed_response)
  
          if response.status_code == 200:
              return parsed_response
          elif response.status_code == 400:
              raise Exception("Bad request: %s" % response.text)
          elif response.status_code == 403:
              msg = "Please make sure your request headers include X-Api-Key and that you are using correct url"
              raise Exception(msg)
          else:
              now = datetime.datetime.utcnow().replace(microsecond=0).isoformat()
              msg = f"""\n\n
              ------------------------------------- BEGIN ERROR MESSAGE -----------------------------------------
              It seems our server encountered an error which it doesn't know how to handle yet. 
              This sometimes happens with unexpected input(s). In order to help us diagnose and resolve the issue, 
              could you please fill out the following information and email the entire message between ----- to
              danf@usc.edu:
              1) URL of notebook (of using the one from https://hub.mybinder.org/...): [*****PLEASE INSERT ONE HERE*****]
              2) Snapshot/picture of the cell that resulted in this error: [*****PLEASE INSERT ONE HERE*****]
      
              Thank you and we apologize for any inconvenience. We'll get back to you as soon as possible!
      
              Sincerely, 
              Dan Feldman
      
              Automatically generated summary:
              - Time of occurrence: {now}
              - Request method + url: {response.request.method} - {response.request.url}
              - Request headers: {response.request.headers}
              - Request body: {response.request.body}
              - Response: {parsed_response}
      
              --------------------------------------- END ERROR MESSAGE ------------------------------------------
              \n\n
              """
  
              raise Exception(msg)
code_tokens: def handle_api_response ( response : requests . Response ) : parsed_response = response . json ( ) DCatAPI . logger_api_resp . debug ( "API Response: %s" , parsed_response ) if response . status_code == 200 : return parsed_response elif response . status_code == 400 : raise Exception ( "Bad request: %s" % response . text ) elif response . status_code == 403 : msg = "Please make sure your request headers include X-Api-Key and that you are using correct url" raise Exception ( msg ) else : now = datetime . datetime . utcnow ( ) . replace ( microsecond = 0 ) . isoformat ( ) msg = f"""\n\n
              ------------------------------------- BEGIN ERROR MESSAGE -----------------------------------------
              It seems our server encountered an error which it doesn't know how to handle yet. 
              This sometimes happens with unexpected input(s). In order to help us diagnose and resolve the issue, 
              could you please fill out the following information and email the entire message between ----- to
              danf@usc.edu:
              1) URL of notebook (of using the one from https://hub.mybinder.org/...): [*****PLEASE INSERT ONE HERE*****]
              2) Snapshot/picture of the cell that resulted in this error: [*****PLEASE INSERT ONE HERE*****]
      
              Thank you and we apologize for any inconvenience. We'll get back to you as soon as possible!
      
              Sincerely, 
              Dan Feldman
      
              Automatically generated summary:
              - Time of occurrence: {now}
              - Request method + url: {response.request.method} - {response.request.url}
              - Request headers: {response.request.headers}
              - Request body: {response.request.body}
              - Response: {parsed_response}
      
              --------------------------------------- END ERROR MESSAGE ------------------------------------------
              \n\n
              """ raise Exception ( msg )
short_docstring: This is a convenience method to handle api responses
short_docstring_tokens: This is a convenience method to handle api responses
comment: """
          This is a convenience method to handle api responses
          :param response:
          :param print_response:
          :return:
          """