本文整理匯總了Python中pulsar.apps.http.HttpClient.headers['content-type']方法的典型用法代碼示例。如果您正苦於以下問題:Python HttpClient.headers['content-type']方法的具體用法?Python HttpClient.headers['content-type']怎麽用?Python HttpClient.headers['content-type']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pulsar.apps.http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.headers['content-type']方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup
# 需要導入模塊: from pulsar.apps.http import HttpClient [as 別名]
# 或者: from pulsar.apps.http.HttpClient import headers['content-type'] [as 別名]
def setup(self, http=None, timeout=None, **kw):
if not http:
timeout = timeout if timeout is not None else self.default_timeout
http = HttpClient(timeout=timeout, **kw)
http.headers['accept'] = 'application/json, text/*; q=0.5'
http.headers['content-type'] = 'application/json'
self.local.http = http
示例2: __init__
# 需要導入模塊: from pulsar.apps.http import HttpClient [as 別名]
# 或者: from pulsar.apps.http.HttpClient import headers['content-type'] [as 別名]
def __init__(self, url, version=None, data=None,
full_response=False, http=None, timeout=None, **kw):
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
http = HttpClient(timeout=timeout, **kw)
http.headers['accept'] = 'application/json, text/*; q=0.5'
http.headers['content-type'] = 'application/json'
self._http = http
示例3: __init__
# 需要導入模塊: from pulsar.apps.http import HttpClient [as 別名]
# 或者: from pulsar.apps.http.HttpClient import headers['content-type'] [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