本文整理汇总了Python中pulsar.apps.http.HttpClient.headers["accept"]方法的典型用法代码示例。如果您正苦于以下问题:Python HttpClient.headers["accept"]方法的具体用法?Python HttpClient.headers["accept"]怎么用?Python HttpClient.headers["accept"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulsar.apps.http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.headers["accept"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pulsar.apps.http import HttpClient [as 别名]
# 或者: from pulsar.apps.http.HttpClient import headers["accept"] [as 别名]
def __init__(
self,
url,
version=None,
data=None,
full_response=False,
http=None,
timeout=None,
sync=False,
loop=None,
encoding="ascii",
**kw
):
self.sync = sync
self._url = url
self._version = version or self.__class__.default_version
self._full_response = full_response
self._data = data if data is not None else {}
if not http:
timeout = timeout if timeout is not None else self.default_timeout
if sync and not loop:
loop = new_event_loop()
http = HttpClient(timeout=timeout, loop=loop, **kw)
http.headers["accept"] = "application/json, text/*; q=0.5"
http.headers["content-type"] = "application/json"
self._http = http
self._encoding = encoding