当前位置: 首页>>代码示例>>Python>>正文


Python BaseObject._execute方法代码示例

本文整理汇总了Python中BaseObject.BaseObject._execute方法的典型用法代码示例。如果您正苦于以下问题:Python BaseObject._execute方法的具体用法?Python BaseObject._execute怎么用?Python BaseObject._execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseObject.BaseObject的用法示例。


在下文中一共展示了BaseObject._execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: transcribe

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
    def transcribe(self, success_callback_url="", error_callback_url=""):
        print >>sys.stderr, "making post request to: %s%s" % (self.dest, self.path + self.uid + self.path_trans)

        data = urllib.urlencode(
            {"success_callback_url": success_callback_url, "error_callback_url": error_callback_url}
        )
        request = urllib2.Request(self.dest + self.path + self.uid + self.path_trans, data=data, headers=self.headers)
        BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:10,代码来源:Media.py

示例2: transcribe

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
 def transcribe(self):
     print >> sys.stderr, 'making post request to: %s%s' % (self.dest,self.path+self.uid+self.path_trans)
     self.datagen = {}
     #print >> sys.stderr, self.username, self.password
     #print >> sys.stderr, type(self.uid)
     #print >> sys.stderr, type(self.path)
     request = urllib2.Request(self.dest+self.path+self.uid+self.path_trans, data="", headers=self.headers)
     BaseObject._execute(self, request)
开发者ID:MarinaZi,项目名称:koemei-api-client,代码行数:10,代码来源:Media.py

示例3: publish

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
    def publish(self):
        print >>sys.stderr, "making put request to: %s%s" % (self.dest, self.path + self.uid + self.path_publish)

        data = {}
        if self.service:
            data.update({"service_name": self.service})

        data = urllib.urlencode(data)
        url = "%s/%s/%s/%s?%s" % (self.dest, self.path, self.uid, self.path_publish, data)

        request = urllib2.Request(url, data="", headers=self.headers)
        request.get_method = lambda: "PUT"
        BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:15,代码来源:Media.py

示例4: get_list

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
    def get_list(self):
        print >> sys.stderr, 'making get request to: %s%s' % (self.dest, self.path)

        data = {}

        if self.count:
            data.update({'count': self.count})

        if self.status:
            data.update({'status_filter':  '-'.join(map(lambda x: str(x), self.status))})

        data = urllib.urlencode(data)
        url = "%s/%s?%s" % (self.dest, self.path, data)

        request = urllib2.Request(url, headers=self.headers)
        BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:18,代码来源:Transcript.py

示例5: create

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
  def create(self):
      print >> sys.stderr, 'making post request to: %s%s' % (self.dest,self.path)
      self.datagen = {}

      if len(self.audioFilename) > 0:
        if 'http' in self.audioFilename :
            self.path = self.path +"?media="+ urllib.quote(self.audioFilename)
            self.datagen = "" # should not be empty dict but empty string!
        else :
            if len(self.metadataFilename) > 0:
                self.datagen, headers_ = multipart_encode({ 'metadata' : create_metadata(self.metadataFilename),
                                                         'media' : open(self.audioFilename, "rb") })
            else:
                self.datagen, headers_ = multipart_encode({ 'media' : open(self.audioFilename, "rb") })
            self.headers.update(headers_)

      #print >> sys.stderr, "request headers: ", self.headers

      request = urllib2.Request(self.dest+self.path, data= self.datagen, headers=self.headers)

      BaseObject._execute(self, request)
开发者ID:MarinaZi,项目名称:koemei-api-client,代码行数:23,代码来源:Media.py

示例6: create

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
    def create(self):
        print >>sys.stderr, "making post request to: %s%s" % (self.dest, self.path)

        data = {}
        if self.service:
            data.update({"service": self.service, "item_id": self.item_id})

        if "http" in self.audioFilename:
            data.update({"media": self.audioFilename})
        else:
            data.update({"media": FileProgress(open(self.audioFilename, "rb"))})

        if self.transcriptFilename:
            self.datagen.update({"transcript": read_file(self.transcriptFilename)})

        headers = self.headers
        data, headers_ = multipart_encode(data)
        headers.update(headers_)

        request = urllib2.Request(self.dest + self.path, data=data, headers=headers)

        BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:24,代码来源:Media.py

示例7: get

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
 def get(self):
     print >> sys.stderr, 'making get request to: %s%s' % (self.dest,self.path+self.uid)
     request = urllib2.Request(self.dest+self.path+self.uid, headers=self.headers)
     BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:6,代码来源:Transcript.py

示例8: create

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
 def create(self):
     print >> sys.stderr, 'making post request to: %s%s' % (self.dest,self.path)
     request = urllib2.Request(self.dest+self.path, data="", headers=self.headers)
     BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:6,代码来源:KObject.py

示例9: delete

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
 def delete(self):
     print >> sys.stderr, 'making delete request to: %s%s' % (self.dest,self.path+self.uid)
     request = urllib2.Request(self.dest+self.path+self.uid, headers=self.headers)
     request.get_method = lambda: 'DELETE'
     BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:7,代码来源:KObject.py

示例10: unpublish

# 需要导入模块: from BaseObject import BaseObject [as 别名]
# 或者: from BaseObject.BaseObject import _execute [as 别名]
 def unpublish(self):
     print >>sys.stderr, "making put request to: %s%s" % (self.dest, self.path + self.uid + self.path_unpublish)
     request = urllib2.Request(self.dest + self.path + self.uid + self.path_unpublish, data="", headers=self.headers)
     request.get_method = lambda: "PUT"
     BaseObject._execute(self, request)
开发者ID:scrappythekangaroo,项目名称:koemei-api-client-python,代码行数:7,代码来源:Media.py


注:本文中的BaseObject.BaseObject._execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。