本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)