本文整理汇总了Python中web_utils.WebUtils类的典型用法代码示例。如果您正苦于以下问题:Python WebUtils类的具体用法?Python WebUtils怎么用?Python WebUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: logout
def logout(self, api_token):
"""
:type api_token: basestring
"""
query_dict = self.__init_access_req_dict(api_token)
# Nothing returned
WebUtils.http_request(self.base_url, self.LOGOUT_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
开发者ID:digideskio,项目名称:cielo24-python,代码行数:7,代码来源:actions.py
示例2: authorize_job
def authorize_job(self, api_token, job_id):
"""
:type api_token: basestring
:type job_id: basestring
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
# Nothing returned
WebUtils.http_request(self.base_url, self.AUTHORIZE_JOB_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
开发者ID:digideskio,项目名称:cielo24-python,代码行数:8,代码来源:actions.py
示例3: update_password
def update_password(self, api_token, new_password, sub_account=None):
self.__assert_argument(new_password, 'New Password')
query_dict = self.__init_access_req_dict(api_token)
query_dict['new_password'] = new_password
if sub_account:
# username parameter named sub_account for clarity
query_dict['username'] = sub_account
# Nothing returned
WebUtils.http_request(self.base_url, self.UPDATE_PASSWORD_PATH, 'POST', WebUtils.BASIC_TIMEOUT, None, None, urlencode(query_dict))
开发者ID:Cielo24,项目名称:SampleCode,代码行数:9,代码来源:actions.py
示例4: remove_api_key
def remove_api_key(self, api_token, api_securekey):
"""
:type api_token: basestring
:type api_securekey: basestring
"""
self.__assert_argument(api_securekey, 'API Secure Key')
query_dict = self.__init_access_req_dict(api_token)
query_dict['api_securekey'] = api_securekey
# Nothing returned
WebUtils.http_request(self.base_url, self.REMOVE_API_KEY_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
开发者ID:digideskio,项目名称:cielo24-python,代码行数:10,代码来源:actions.py
示例5: add_media_to_job_file
def add_media_to_job_file(self, api_token, job_id, media_file):
self.__assert_argument(media_file, 'Media File')
query_dict = self.__init_job_req_dict(api_token, job_id)
file_size = fstat(media_file.fileno()).st_size
response = WebUtils.get_json(self.base_url, self.ADD_MEDIA_TO_JOB_PATH, 'POST', WebUtils.UPLOAD_TIMEOUT,
query_dict, {'Content-Type': 'video/mp4', 'Content-Length': file_size}, media_file)
return response['TaskId']
开发者ID:Cielo24,项目名称:SampleCode,代码行数:7,代码来源:actions.py
示例6: login
def login(self, username, password=None, api_securekey=None, use_headers=False):
"""
:type username: basestring
:type password: basestring|None
:type api_securekey: basestring|None
:type use_headers: bool
:rtype: basestring
"""
self.__assert_argument(username, 'Username')
# Password or API Secure Key must be supplied but not both
if password is None and api_securekey is None:
raise ValueError('Password or API Secure Key must be supplied for login.')
query_dict = self.__init_version_dict()
headers = dict()
if use_headers:
headers['x-auth-user'] = username
if password:
headers['x-auth-password'] = password
if api_securekey:
headers['x-auth-securekey'] = api_securekey
else:
query_dict['username'] = username
if password:
query_dict['password'] = password
if api_securekey:
query_dict['securekey'] = api_securekey
response = WebUtils.get_json(self.base_url, self.LOGIN_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict, headers)
return response['ApiToken']
开发者ID:digideskio,项目名称:cielo24-python,代码行数:31,代码来源:actions.py
示例7: generate_api_key
def generate_api_key(self, api_token, username, force_new=False):
self.__assert_argument(username, 'Username')
query_dict = self.__init_access_req_dict(api_token)
query_dict['account_id'] = username
query_dict['force_new'] = force_new
response = WebUtils.get_json(self.base_url, self.GENERATE_API_KEY_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response['ApiKey']
开发者ID:Cielo24,项目名称:SampleCode,代码行数:7,代码来源:actions.py
示例8: get_element_list
def get_element_list(self, api_token, job_id, elementlist_version=None):
query_dict = self.__init_job_req_dict(api_token, job_id)
if elementlist_version:
query_dict['elementlist_version'] = elementlist_version
response = WebUtils.get_json(self.base_url, self.GET_ELEMENT_LIST_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response
开发者ID:Cielo24,项目名称:SampleCode,代码行数:7,代码来源:actions.py
示例9: perform_transcription
def perform_transcription(self,
api_token,
job_id,
fidelity,
priority=None,
callback_url=None,
turnaround_hours=None,
target_language=None,
options=None):
self.__assert_argument(fidelity, 'Fidelity')
query_dict = self.__init_job_req_dict(api_token, job_id)
query_dict['transcription_fidelity'] = fidelity
if priority:
query_dict['priority'] = priority
if callback_url:
query_dict['callback_url'] = callback_url
if turnaround_hours:
query_dict['turnaround_hours'] = turnaround_hours
if target_language:
query_dict['target_language'] = target_language
if options:
query_dict['options'] = json.dumps(options.get_dict())
response = WebUtils.get_json(self.base_url, self.PERFORM_TRANSCRIPTION, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response['TaskId']
开发者ID:Cielo24,项目名称:SampleCode,代码行数:25,代码来源:actions.py
示例10: get_job_info
def get_job_info(self, api_token, job_id):
"""
:type api_token: basestring
:type job_id: basestring
:rtype: dict
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
response = WebUtils.get_json(self.base_url, self.GET_JOB_INFO_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response
开发者ID:digideskio,项目名称:cielo24-python,代码行数:9,代码来源:actions.py
示例11: get_list_of_element_lists
def get_list_of_element_lists(self, api_token, job_id):
"""
:type api_token: basestring
:type job_id: basestring
:rtype: list
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
response = WebUtils.get_json(self.base_url, self.GET_LIST_OF_ELEMENT_LISTS_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response
开发者ID:digideskio,项目名称:cielo24-python,代码行数:9,代码来源:actions.py
示例12: get_media
def get_media(self, api_token, job_id):
"""
:type api_token: basestring
:type job_id: basestring
:rtype: basestring
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
response = WebUtils.get_json(self.base_url, self.GET_MEDIA_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response['MediaUrl']
开发者ID:digideskio,项目名称:cielo24-python,代码行数:9,代码来源:actions.py
示例13: delete_job
def delete_job(self, api_token, job_id):
"""
:type api_token: basestring
:type job_id: basestring
:rtype: basestring
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
response = WebUtils.get_json(self.base_url, self.DELETE_JOB_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response['TaskId']
开发者ID:digideskio,项目名称:cielo24-python,代码行数:9,代码来源:actions.py
示例14: get_job_list
def get_job_list(self, api_token, options=None):
"""
:type api_token: basestring
:type options: JobListOptions|None
:rtype: list
"""
query_dict = self.__init_access_req_dict(api_token)
if options:
query_dict.update(options.get_dict())
response = WebUtils.get_json(self.base_url, self.GET_JOB_LIST_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response
开发者ID:digideskio,项目名称:cielo24-python,代码行数:11,代码来源:actions.py
示例15: get_transcript
def get_transcript(self, api_token, job_id, transcript_options=None):
"""
:type api_token: basestring
:type job_id: basestring
:type transcript_options: TranscriptOptions|None
:rtype: basestring
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
if transcript_options:
query_dict.update(transcript_options.get_dict())
# Returns raw transcript text
return WebUtils.http_request(self.base_url, self.GET_TRANSCRIPT_PATH, 'GET', WebUtils.DOWNLOAD_TIMEOUT, query_dict)
开发者ID:digideskio,项目名称:cielo24-python,代码行数:12,代码来源:actions.py
示例16: get_caption
def get_caption(self, api_token, job_id, caption_format, caption_options=None):
self.__assert_argument(caption_format, 'Caption Format')
query_dict = self.__init_job_req_dict(api_token, job_id)
query_dict['caption_format'] = caption_format
if caption_options:
query_dict.update(caption_options.get_dict())
response = WebUtils.http_request(self.base_url, self.GET_CAPTION_PATH, 'GET', WebUtils.DOWNLOAD_TIMEOUT, query_dict)
if caption_options and caption_options.build_url: # If build_url is true
return JSONDecoder().decode(response)['CaptionUrl'] # Return Caption URL
else:
return response # Else return raw caption text
开发者ID:Cielo24,项目名称:SampleCode,代码行数:12,代码来源:actions.py
示例17: get_element_list
def get_element_list(self, api_token, job_id, elementlist_version=None):
"""
:type api_token: basestring
:type job_id: basestring
:type elementlist_version: datetime|basestring
:rtype: dict
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
if elementlist_version:
query_dict['elementlist_version'] = elementlist_version
response = WebUtils.get_json(self.base_url, self.GET_ELEMENT_LIST_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response
开发者ID:digideskio,项目名称:cielo24-python,代码行数:13,代码来源:actions.py
示例18: generate_api_key
def generate_api_key(self, api_token, sub_account=None, force_new=False):
"""
:type api_token: basestring
:type sub_account: basestring|None
:type force_new: bool
:rtype: basestring
"""
query_dict = self.__init_access_req_dict(api_token)
if sub_account:
# account_id parameter named sub_account for clarity
query_dict['account_id'] = sub_account
query_dict['force_new'] = force_new
response = WebUtils.get_json(self.base_url, self.GENERATE_API_KEY_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
return response['ApiKey']
开发者ID:digideskio,项目名称:cielo24-python,代码行数:14,代码来源:actions.py
示例19: modify_job
def modify_job(self, api_token, job_id, fidelity=None, turnaround_hours=None, priority=None):
"""
Modify parameters of an already existing job. The job must be in Authorization state.
:param api_token: The API token used for this session
:type api_token: basestring
:param job_id: The ID of the job which is being modified
:type job_id: basestring
:param fidelity: The desired fidelity of the transcription
:type fidelity: Fidelity|basestring|None
:param turnaround_hours: The number of hours after which the job is returned
:type turnaround_hours: int|None
:param priority: The desired priority of the transcription
:type priority: Priority|basestring|None
"""
query_dict = self.__init_job_req_dict(api_token, job_id)
if fidelity:
query_dict['transcription_fidelity'] = fidelity
if priority:
query_dict['priority'] = priority
if turnaround_hours:
query_dict['turnaround_hours'] = turnaround_hours
WebUtils.http_request(self.base_url, self.MODIFY_JOB_PATH, 'POST', WebUtils.BASIC_TIMEOUT, query_dict)
开发者ID:Cielo24,项目名称:cielo24-python,代码行数:24,代码来源:actions.py
示例20: create_job
def create_job(self, api_token, job_name=None, language=Language.ENGLISH, external_id=None, sub_account=None):
query_dict = self.__init_access_req_dict(api_token)
if job_name:
query_dict['job_name'] = job_name
if language:
query_dict['language'] = language
if external_id:
query_dict['external_id'] = external_id
if sub_account:
# username parameter named sub_account for clarity
query_dict['username'] = sub_account
response = WebUtils.get_json(self.base_url, self.CREATE_JOB_PATH, 'GET', WebUtils.BASIC_TIMEOUT, query_dict)
# Return a hash with JobId and TaskId
return response
开发者ID:Cielo24,项目名称:SampleCode,代码行数:16,代码来源:actions.py
注:本文中的web_utils.WebUtils类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论