コード例 #1
0
ファイル: api.py プロジェクト: lw000/new_python_demo
 def __init__(self, debug=1):
     self.__loginer = LoginApi(debug)
     
     self.__apiModules = []
     self.__apiModules.append(UserApi(debug))
     self.__apiModules.append(DiscussApi(debug))
     self.__apiModules.append(SettingApi(debug))
     self.__apiModules.append(AreaApi(debug))
     self.__apiModules.append(SocialApi(debug))
     self.__apiModules.append(WalletApi(debug))
     self.__apiModules.append(ContactApi(debug))
コード例 #2
0
ファイル: api.py プロジェクト: lw000/new_python_demo
class TesterApi():
    def __init__(self, debug=1):
        self.__loginer = LoginApi(debug)
        
        self.__apiModules = []
        self.__apiModules.append(UserApi(debug))
        self.__apiModules.append(DiscussApi(debug))
        self.__apiModules.append(SettingApi(debug))
        self.__apiModules.append(AreaApi(debug))
        self.__apiModules.append(SocialApi(debug))
        self.__apiModules.append(WalletApi(debug))
        self.__apiModules.append(ContactApi(debug))
        
    def start(self):
        for _, v in enumerate(self.__apiModules):
            v.start()
                        
    def stop(self):
        for _, v in enumerate(self.__apiModules):
            v.stop()
    
    def login(self, account, pwd):
        ok = self.__loginer.login(account, pwd)
        return ok
    
    @property
    def account(self):
        return self.__loginer.account
    
    @account.setter
    def account(self, account):
        self.__loginer.account = account
        
    @property
    def pwd(self):
        return self.__loginer.pwd
     
    @pwd.setter
    def pwd(self, pwd):
        self.__loginer.pwd = pwd
        

                                        
コード例 #3
0
ファイル: api_discuss.py プロジェクト: lw000/new_python_demo
            print('[code: %d result:%s]' % (code, result))
                            
    def __discuss_detail(self, method):
        params = dict(uid=tester_config.login_result_data['uid'], discuss_id=48585)
        
        code, result = self.post(method=method, usetoken=True, params=params)  
        if (code == 1) or (code == 0):
            print(result)
        else:
            print('[code: %d result:%s]' % (code, result))
        
    def __discuss_myDiscuss(self, method):
        params = dict(uid=tester_config.login_result_data['uid'], to_uid=tester_config.login_result_data['uid'], type=0, limit=20, page=1)
        
        code, result = self.post(method=method, usetoken=True, params=params)  
        if (code == 1) or (code == 0):
            print(result)
        else:
            print('[code: %d result:%s]' % (code, result))
            
            
if __name__ == '__main__': 
    from api_login import LoginApi
    login = LoginApi(debug=1)
    login.account = tester_config.account
    login.pwd = tester_config.pwd
    if login.login(tester_config.account, tester_config.pwd):
        tester = DiscussApi(debug=1)
        tester.start()
        tester.stop() 
コード例 #4
0
ファイル: api_setting.py プロジェクト: lw000/new_python_demo
        if (code == 1) or (code == 0):
            print(result)
        else:
            print('[code: %d result:%s]' % (code, result))

    def __setting_set(self, method):
        if 1:
            params = dict(uid=tester_config.login_result_data['uid'],
                          key='hide_location',
                          val=0)
        else:
            params = dict(uid=tester_config.login_result_data['uid'],
                          key='look_fans',
                          val=0)

        code, result = self.post(method=method, usetoken=True, params=params)
        if (code == 1) or (code == 0):
            print(result)
        else:
            print('[code: %d result:%s]' % (code, result))


if __name__ == '__main__':
    from api_login import LoginApi
    debug = 1
    login = LoginApi(debug=debug)
    if login.login(tester_config.account, tester_config.pwd):
        tester = SettingApi(debug=debug)
        tester.start()
        tester.stop()