本文整理汇总了Python中api.API.post方法的典型用法代码示例。如果您正苦于以下问题:Python API.post方法的具体用法?Python API.post怎么用?Python API.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.API
的用法示例。
在下文中一共展示了API.post方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: push
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def push(self):
parameter = core.parameter_encode(self.attributes)
parameter["command"] = "update_project"
res = API.post(parameter)
if res:
print res
return True
else:
return False
示例2: delete
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def delete(self):
parameter = self.get_parameters()
parameter["command"] = "remove_task_metadata"
res = API.post(parameter)
if res:
print 'Delete ', res
return True
else:
return False
示例3: delete
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def delete(self):
parameter = dict()
parameter["id"] = self.get_attr('id')
parameter["command"] = "remove_task_note"
res = API.post(parameter)
if res:
print res
return True
else:
return False
示例4: save
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def save(self):
parameter = core.parameter_encode(self.attributes)
parameter["command"] = "add_task_target_type"
res = API.post(parameter)
if res:
data = json.loads(res)
self.attributes.update(data)
return True
else:
return False
示例5: _send_self
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def _send_self(self, api_cmd):
parameter = self.get_parameters()
parameter["command"] = api_cmd
try:
data = json.loads(API.post(parameter))
self.update_attr(data)
return True
except Exception, e:
print(e)
return False
示例6: _load
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def _load(cls, api_cmd):
data = dict()
data["command"] = api_cmd
try:
res_data = json.loads(API.post(data))
for data in res_data:
cls.add(cls.create(data))
return True
except Exception, e:
print e
return False
示例7: save
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def save(self):
if not self.task:
print "The note have not mission_code."
return False
parameter = core.parameter_encode(self.attributes)
parameter["command"] = "add_task_note"
res = API.post(parameter)
if res:
data = json.loads(res)
self.attributes.update(data)
return True
else:
return False
示例8: save
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def save(self):
if 'task' not in self.attributes:
print "The metadata have not task id."
return False
parameter = self.get_parameters()
parameter["command"] = "add_task_metadata"
res = API.post(parameter)
if res:
date = json.loads(res)
self.update_attr(date)
return True
else:
return False
示例9: load_all_types
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def load_all_types():
data = dict()
data["command"] = "task_targets"
res = API.post(data)
if not res:
return []
res_data = json.loads(res)
if not res_data:
return []
res_list = []
for p in res_data:
res_list.append(TaskTargetType(p))
return res_list
示例10: projects
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def projects():
data = dict()
data["command"] = "projects"
res = API.post(data)
if not res:
return []
project_data = json.loads(res)
if not project_data:
return []
projects = []
for p in project_data:
projects.append(Project.create(p))
return projects
示例11: tasks
# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import post [as 别名]
def tasks(self):
"""return task list"""
data = dict()
data["command"] = "project_missions"
data["project_id"] = self.get_attr('id')
task_list = []
res = API.post(data)
if not res:
return task_list
tasks_data = json.loads(res)
if not tasks_data:
return task_list
for t in tasks_data:
# t["start_date"] = datetime_to_date(t.get("start_date", ""))
# t["due_date"] = datetime_to_date(t.get("due_date", ""))
task_list.append(Task(t))
return task_list