コード例 #1
0
 def get(self):
     """params:
        sns: (sina|twitter|facebook) *
        func_name: *
        access_token: *
        parameter: optional"""
     self.response.headers["Content-Type"] = 'text/plain'
     try:
         sns = self.request.get("sns")
         func_name = self.request.get("func_name")
         access_token = self.request.get("access_token")
         access_secret = self.request.get("access_secret")
         req = {}
         for i in self.request.arguments():
             if i not in ("sns", "func_name","access_token","access_secret"):
                 req[i] = self.request.get(i)
         account = getattr(self, "_do_%s"%sns)(func_name, access_token, access_secret, req)
         if not account.has_expired():
             response = getattr(account.api, func_name)(**req)
         else:
             response = util.Error_Expired
     except util.DeadlineErrors:
         response = util.Error_Server_Busy
     except:
         response = util.Error_Bad_Request
     self.response.write(object_to_xml(response).toxml())
コード例 #2
0
ファイル: intf_sep.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     self.response.headers['Content-Type'] = 'text/plain'
     self._text = self.request.get('text')
     self._sns = self.request.get('sns')
     self._exp = reg[self._sns]
     res = {'result': self._work()}
     self.response.write(object_to_xml(res).toxml())
コード例 #3
0
ファイル: intf_sep.py プロジェクト: hsfzxjy/hfzk2013
 def get(self):
     self.response.headers['Content-Type'] = 'text/plain'
     self._text = self.request.get('text')
     self._sns = self.request.get('sns')
     self._exp = reg[self._sns]
     res = {'result': self._work()}
     self.response.write(object_to_xml(res).toxml())
コード例 #4
0
ファイル: user.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     '''
       Request e.g. 
       account_type=sina&account_name=13434312012&access_token=XXXXXXXXXXXXX
     '''
     self.response.headers['Content-Type'] = 'text/plain'
     arg = util.login_data_decode(self.request)
     res = {}
     if arg["account_name"]:
         res = arg
     else:
         res = util.Error_Server_Busy
     self.response.write(code.object_to_xml(res).toxml())
コード例 #5
0
ファイル: user.py プロジェクト: hsfzxjy/hfzk2013
 def get(self):
     '''
       Request e.g. 
       account_type=sina&account_name=13434312012&access_token=XXXXXXXXXXXXX
     '''
     self.response.headers['Content-Type'] = 'text/plain'
     arg = util.login_data_decode(self.request)
     res = {}
     if arg["account_name"]:
         res = arg
     else:
         res = util.Error_Server_Busy
     self.response.write(code.object_to_xml(res).toxml())
コード例 #6
0
ファイル: account.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     self.response.headers['Content-Type'] = 'text/plain'
     account_type = self.request.get('account_type')
     account_name = self.request.get('account_name')
     req = {'account_type': account_type, 
             'account_name': account_name}        
     account = userop.get_account(req)
     
     if account:
         has_expired = getattr(self, '_do_%s' % account_type)(account)
         res = {'result': has_expired}
     else:
         res = util.Error_Bad_Request
     
     self.response.write(code.object_to_xml(res).toxml())
コード例 #7
0
ファイル: user.py プロジェクト: GVPrevost/hfzk2013
class User_QueryHandler(webapp2.RequestHandler):
    def get(self):
        '''
           Request e.g.
           ID=12&type=json
        '''
        self.response.headers["Content-Type"] = 'text/plain'
        ID = int(self.request.get("ID"))
        type = self.request.get("type")
        try:
            info = userop.get_data(ID)
        except userop.UserError, e:
            info = {"_error": str(e)}
        res = code.object_to_xml(info).toxml() if type == 'xml' else \
                        code.object_to_json(info)
        self.response.write(res)
コード例 #8
0
ファイル: user.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     '''
       e.g. ID=1&method=(add|combine|delete|create)
     '''
     self.response.headers['Content-Type'] = 'text/plain'
     method = self.request.get('method')
     if method != 'create':
         self.__ID = int(self.request.get('ID'))
     data = {}
     for i in self.request.arguments():
         if i not in ('ID', 'method'):
             data[i] = self.request.get(i)
     #try:
     res = getattr(self, '_do_%s' % method)(data)
     #except:
     #res = None
     if not res:
         res = util.Error_Bad_Request
     self.response.write(code.object_to_xml(res).toxml())
コード例 #9
0
ファイル: user.py プロジェクト: hsfzxjy/hfzk2013
 def get(self):
     '''
       e.g. ID=1&method=(add|combine|delete|create)
     '''
     self.response.headers['Content-Type'] = 'text/plain'
     method = self.request.get('method')
     if method != 'create':
         self.__ID = int(self.request.get('ID'))
     data = {}
     for i in self.request.arguments():
         if i not in ('ID', 'method'):
             data[i] = self.request.get(i)
     #try:
     res = getattr(self, '_do_%s' % method)(data)
     #except:
         #res = None
     if not res:
         res = util.Error_Bad_Request
     self.response.write(code.object_to_xml(res).toxml())
コード例 #10
0
ファイル: account.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     """Params
        account_type, account_name"""
     try:
         self.response.headers['Content-Type'] = 'text/plain'
         account_type = self.request.get('account_type')
         account_name = self.request.get('account_name')
         
         req = {'account_type': account_type, 
                'account_name': account_name}
         account = userop.get_account(req)
         
         res = {'ID':''}
         if account:
             res['ID'] = str(userop.get_user(account).ID)
         else:
             res['ID'] = 'None'
     except:
         res = util.Error_Bad_Request
         
     self.response.write(code.object_to_xml(res).toxml())        
コード例 #11
0
ファイル: intf_smart.py プロジェクト: GVPrevost/hfzk2013
 def get(self):
     account_type = self.request.get('sns')
     self._category = self.request.get('category')
     self._access_token = self.request.get('access_token')
     self._access_secret = self.request.get('access_secret') if self.request.get('access_secret') else ''
     req = {}
     for i in self.request.arguments():
         if i not in ('sns', 'access_token', 'account_type', 'access_secret'):
             req[i] = self.request.get(i)
     self.response.headers['Content-Type'] = 'text/plain'
     try:
         account = getattr(self,'_do_%s'%account_type)(req)
         result = getattr(account, self._category)(**req)
     except util.DeadlineErrors:
         result = util.Error_Server_Busy
     except:
         result = util.Error_Bad_Request
         
     _type = self.request.get('type') if self.request.get('type') else 'xml'
     if _type.lower() == 'xml':
         self.response.write(code.object_to_xml(result).toxml())
     else:
         self.response.write(code.object_to_json(result))