client.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:catFaceSwapSendToTodd 作者: Micasou 项目源码 文件源码
def _multi_dataurl_op(self, urls, ops, model=None, local_ids=None, meta=None,
                         payload=None, **kwargs):
    """ If sending image_url or image_file strings, then we can send as json directly instead of the
    multipart form. """
    if urls is not None: # for feedback, this might not be required.
      if not isinstance(urls, list):
        urls = [urls]
      self._check_batch_size(urls)
      if not isinstance(urls[0], basestring):
        raise Exception("urls must be strings")
    data = self._setup_multi_data(ops, len(urls), model, local_ids, meta, **kwargs)
    # Add some addition url specific stuff to data dict:
    if urls is not None:
      data['url'] = urls
    if payload:
      assert isinstance(payload, dict), "Addition payload must be a dict"
      for (k, v) in iteritems(payload):
        data[k] = v
    url = self._url_for_op(ops)
    kwargs = {'data': data}
    raw_response = self._get_raw_response(
        self._get_json_headers, self._get_json_response, url, kwargs)
    return self._parse_response(raw_response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号