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


Python User.update方法代码示例

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


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

示例1: update

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
    def update(self, token, display_name = None, password = None):
        """
        Updates user's profile

        :param token: Token which was returned by login method
        :param display_name: New user display name.
        :param password: new password
        :return: None
        """
        User.update(token.userid, display_name, password)
        return {}
开发者ID:frm-system,项目名称:frm,代码行数:13,代码来源:userapi.py

示例2: on_user_state

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
 def on_user_state(self, msg):
   if msg.session not in self.users_by_session:
     user = User(self.bot, msg.session)
     self.users_by_session[msg.session] = user
     if msg.user_id is not None:
       self.users_by_id[msg.user_id] = user
   else:
     user = self.users_by_session[msg.session]
   user.update(msg)
   if self.user is None:
     self.user = user
开发者ID:Hicks85,项目名称:mumble-bots,代码行数:13,代码来源:bot.py

示例3: login_signup_callback_view

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
def login_signup_callback_view():
  error = request.args.get('error')
  code = request.args.get('code')
  if not code:
    return error or 'error'
  credentials = get_flow().step2_exchange(code)
  credentials_object = json.loads(credentials.to_json())
  user_info = User.fetch_info(credentials)
  u = User(user_info['email'])
  if not u.check():
    u.create(credentials=credentials_object, **user_info)
  if u.get('disabled', False):
    u.update({'disabled': False, 'credentials': credentials_object})
  login_user(u, remember=True)
  return redirect(url_for('index_view'))
开发者ID:ProjectClarity,项目名称:web,代码行数:17,代码来源:routes.py

示例4: main

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
def main():
    #    user = random_user()
    #    with open(FILENAME, "w") as f:
    #        f.write(user.yaml())

    print 70 * "="
    user = User()
    user = read_user(FILENAME)

    print 70 * "="
    pprint(user.json())
    user.save()

    user.update(**{"set__username": "Hallo"})
    user.save()
    print User.objects(username="Hallo")
开发者ID:lee212,项目名称:cloudmesh,代码行数:18,代码来源:read.py

示例5: updateDb

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
def updateDb():
	user_names = ['ibnlive','timesnow','HeadlinesToday','ndtv']
	connection = pymongo.MongoClient("localhost", 27017)
	
	# create a database if not exists
	db = connection.twitter

	# crate collections for users
	# users = db.users
	users = db.users_new
	
	auth = tweepy.OAuthHandler("oURSVON6rRvw7gi3aCMNYg","lFzae5HXsGwhyqxdbKtYStzPy0IRI7oEAIoXbvDiRDI")
	auth.set_access_token("2243361606-6WHyclCNIuj2uAq6cJKZtScNI2XGDxCWANSlX64","lIDvQ8pTaJLDDyBIXWzwOAxwA0QXn9moFL6QUp7v1RytL")
	api = tweepy.API(auth)
	try:
		data_list = []
		for user_name in user_names:
			user = User(user_name,api,since_ids[user_name])
			user.update(api)
			data_list.append({'user_name': user_name,'data' : user.getUserDict()})

		users.insert(data_list)
	except:
		print "some kirick"
开发者ID:nvnvenki,项目名称:MSE-Project,代码行数:26,代码来源:db.py

示例6: update

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
def update():
    request_data = get_json(request)

    code, response = User.update(request_data['user'], request_data['about'], request_data['name'])
    return json.dumps({'code': code, 'response': response})
开发者ID:dm-tyurin,项目名称:tp-subd,代码行数:7,代码来源:user_view.py

示例7: raw_input

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
            else:
                user = None
                print "Login failed."

        if command == "logout":
            user = None

        elif command == "update":
            if not user:
                print "Please login first"
                continue

            new_email = raw_input("New Email: ")
            new_password = getpass.getpass("New Password: ")

            user.update(new_email, bcrypt.hashpw(new_password, bcrypt.gensalt(10)))
            user.email = new_email
            user.password = new_password

        elif command == "delete":
            if not user:
                print "Please login first"
                continue

            confirm = raw_input("Are you sure? Y/n: ")

            if confirm == "Y" or confirm == "y" or confirm == "yes" or confirm == "Yes":
                print "deleting %s with password %s" % (user.email, user.password)
                
                user.delete()
                user = None
开发者ID:wbthomason,项目名称:cs3240-onedir,代码行数:33,代码来源:one_dir_client.py

示例8: User

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import update [as 别名]
      return header['value']
  return None

while True:
  for u in users.find({'disabled': True}):
    user = User(u['email'])
    expiry_date = datetime.datetime.utcnow() - datetime.timedelta(hours=1)
    if user.get('disabled_at', expiry_date) <= expiry_date:
      user.set('disabled', False)
  for u in users.find({'disabled': {'$ne': True}}):
    user = User(u['email'])
    try:
      messages, history_token = user.get_new_messages()
    except oauth2client.client.AccessTokenRefreshError:
      print "Disabled User {}".format(user.get('_id'))
      user.update({'disabled': True, 'disabled_at': datetime.datetime.utcnow()})
      continue
    user.set('history_token', history_token)
    for message in messages:
      if 'TRASH' in message.get('labelIds', []):
        continue
      if processed_data.find_one({'email_id': message['id']}):
        continue
      if message['payload']['mimeType'] in ['text/plain', 'text/html']:
        body = message['payload']['body'].get('data')
        mime_type = message['payload']['mimeType']
      else:
        parts = message['payload']['parts']
        body = None
        mime_type = None
        order = ['text/plain', 'text/html']
开发者ID:ProjectClarity,项目名称:importer,代码行数:33,代码来源:monitor.py


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