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


Python Entity.requests方法代码示例

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


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

示例1: saveApplication

# 需要导入模块: from azure.storage import Entity [as 别名]
# 或者: from azure.storage.Entity import requests [as 别名]
def saveApplication(application):
	app = Entity()
	app.PartitionKey = application['partition'] #uiquely identifies a partition of entities 
	app.RowKey = str(next(unique_sequence)) 	
	# app.RowKey = "kjlhajkdlhfjhasdnfasdkjflnasdf"	
	app.package_type = application['apptype']
	app.name = application['name']
	app.reigon = application['reigon']
	app.port = str(services.get_port())
	app.priority = priority	
	app.requests = str(0)
	app.cost = str(0)
	user = user_services.get_user_by_email(application['partition']) #get the current user
	if user is not None:

		app_count = int(user.app_count) #get app count an convert to int
		try:
			if app_count >= 0 : #if there is a valid amount of apps
				ts.insert_entity(table,app) #add new app
				print "new app created"
				app_count+=1 #increase the count
				user.app_count = str(app_count) #convert count back to str
				if user_services.update_user(application['partition'], user): #update the user count
					print "user app count updated"
					print "notifying that a new app was created..."
					temp = {
						"partition" 	: app.PartitionKey,
						"rowkey"		: app.RowKey,
						"package_type" 	: app.package_type,
						"status" 		: "created"
					}
					notifying.notify_client("http://146.148.74.93:3000/update_package", temp)
					print " success"
					return app_count
				else :
					return -1
			# return True
		except Exception, e:		
			return -1
开发者ID:wryi,项目名称:RCMS,代码行数:41,代码来源:table_services.py


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