MCPcopy Index your code
hub / github.com/dataforseo/PythonClient / select_header_accept

Method select_header_accept

dataforseo_client/api_client.py:536–549  ·  view source on GitHub ↗

Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json).

(self, accepts: List[str])

Source from the content-addressed store, hash-verified

534 return params
535
536 def select_header_accept(self, accepts: List[str]) -> Optional[str]:
537 """Returns `Accept` based on an array of accepts provided.
538
539 :param accepts: List of headers.
540 :return: Accept (e.g. application/json).
541 """
542 if not accepts:
543 return None
544
545 for accept in accepts:
546 if re.search('json', accept, re.IGNORECASE):
547 return accept
548
549 return accepts[0]
550
551 def select_header_content_type(self, content_types):
552 """Returns `Content-Type` based on an array of content_types provided.

Calls

no outgoing calls

Tested by

no test coverage detected