本文整理汇总了Python中googleapiclient.http.BatchHttpRequest._serialize_request方法的典型用法代码示例。如果您正苦于以下问题:Python BatchHttpRequest._serialize_request方法的具体用法?Python BatchHttpRequest._serialize_request怎么用?Python BatchHttpRequest._serialize_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类googleapiclient.http.BatchHttpRequest
的用法示例。
在下文中一共展示了BatchHttpRequest._serialize_request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serialize_request_no_body
# 需要导入模块: from googleapiclient.http import BatchHttpRequest [as 别名]
# 或者: from googleapiclient.http.BatchHttpRequest import _serialize_request [as 别名]
def test_serialize_request_no_body(self):
batch = BatchHttpRequest()
request = HttpRequest(
None,
None,
'https://www.googleapis.com/someapi/v1/collection/?foo=bar',
method='POST',
body='',
headers={'content-type': 'application/json'},
methodId=None,
resumable=None)
s = batch._serialize_request(request).splitlines()
self.assertEqual(NO_BODY_EXPECTED.splitlines(), s)
示例2: test_serialize_request_media_body
# 需要导入模块: from googleapiclient.http import BatchHttpRequest [as 别名]
# 或者: from googleapiclient.http.BatchHttpRequest import _serialize_request [as 别名]
def test_serialize_request_media_body(self):
batch = BatchHttpRequest()
f = open(datafile('small.png'))
body = f.read()
f.close()
request = HttpRequest(
None,
None,
'https://www.googleapis.com/someapi/v1/collection/?foo=bar',
method='POST',
body=body,
headers={'content-type': 'application/json'},
methodId=None,
resumable=None)
# Just testing it shouldn't raise an exception.
s = batch._serialize_request(request).splitlines()