Пример #1
0
 def __getUserInfo(self,userName,password):
     base = conf.read_config(conf.path, 'API', 'baseUrl')
     api = conf.read_config(conf.path, 'API', 'loginApi')
     url = base + api 
     data = {'name': userName,'password':password}
     s = requests.session()
     result = s.post(url,data = data)
     s.keep_alive = False  
     if  result.json() != "error":
         return result.json()['Table']
     else:
         return "error"
Пример #2
0
 def __getCompetence(self,uid):
     base = conf.read_config(conf.path, 'API', 'baseUrl')
     api = conf.read_config(conf.path, 'API', 'getUserRule')
     url = base + api
     s = requests.session()
     idData = { 'ID': uid, 'VALUE': '5' };
     result = s.post(url,data = idData)
     s.keep_alive = False 
     if result.text != u"null":
         return result.json()['AUTH']
     else:
         return ""
Пример #3
0
 def __addImg(self,data):
     api = conf.read_config(conf.path, 'API', 'addImgApi')
     url = base + api
     s = requests.session()
     result = s.post(url,data)
     s.keep_alive = False       
     return result.text
Пример #4
0
 def __getLastVersion(self,entity_id,entity_type):
     api = conf.read_config(conf.path, 'API', 'getLastVersionApi')
     url = base + api + '?entity_id=' + entity_id + '&entity_type=' + entity_type
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False     
     return result.content
Пример #5
0
 def __getAssetByType(self,pid):
     api = conf.read_config(conf.path, 'API', 'getAssetByTypeApi')
     url = base + api + '?project_id=' + pid
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False 
     return result.json()
Пример #6
0
 def __getTaskStep(self,uid,pid,tableName):
     api = conf.read_config(conf.path, 'API', 'getTaskStepApi')
     url = base + api + '?user_id=' +  uid  + '&project_id='+ pid
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     return result.json()[tableName]
Пример #7
0
 def __upLoadFile(self,filePath,directory):
     api = conf.read_config(conf.path, 'API', 'publishFileApi')
     url = base + api + '?f=' + directory
     files = {'file': open(filePath, 'rb')}
     s = requests.session()
     s.post(url, files=files)
     s.keep_alive = False   
Пример #8
0
 def __getReferenceVersion(self,version_id):
     api = conf.read_config(conf.path, 'API', 'getReferenceVersionApi')
     url = base + api + '?version_id=' + version_id 
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False    
     if result.text != u"null":
         return result.json()['ATTACHMENTID']
     else:
         return ""
Пример #9
0
 def __getVersion(self,vname,pid):
     api = conf.read_config(conf.path, 'API', 'getVersionByNameApi')
     url = base + api + '?versionName=' + vname + '&project_id=' + pid
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False  
     if result.text != u"null":
         return result.json()['VERSION']
     else:
         return ""
Пример #10
0
 def __getProject(self,uid):
     api = conf.read_config(conf.path, 'API', 'getProjectApi')
     url = base + api + '?user_id=' + uid
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False
     if result.text != u"null":
         return result.json()['PROJECT']
     else:
         return ""
Пример #11
0
 def __getSingleTask(self,uid,taskId,stepId):
     api = conf.read_config(conf.path, 'API', 'getSingleTaskApi')
     url = (base + api + '?uid=' + uid + '&task_id=' + taskId + '&step_id=' + stepId)
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     if result.text != u"null":
         return result.json()['TASK']
     else:
         return ""   
Пример #12
0
 def __getAsset(self,uid,project_id,start,length):
     api = conf.read_config(conf.path, 'API', 'getAssetApi')
     url = base + api + '?uid=' + uid +  '&project_id=' + project_id + '&start=' + start + '&length=' + length
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     if result.text != u"null":
         return result.json()['ASSET']
     else:
         return ""
Пример #13
0
 def __getAssetType(self):
     api = conf.read_config(conf.path, 'API', 'getAssetTypeAPi')
     url = base + api
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False  
     if result.text != u"null":
         return result.json()['ASSETTYPE']
     else:
         return ""
Пример #14
0
 def __getSingleAsset(self,pid,entityId,entityType):
     api = conf.read_config(conf.path, 'API', 'getSingleAssetApi')
     url = base + api +  '?project_id=' + pid + '&entity_id=' + entityId + '&entity_type=' + entityType 
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     if result.text != u"null":
         return result.json()['SA']
     else:
         return ""
Пример #15
0
 def __getImg(self,imgId):
     api = conf.read_config(conf.path, 'API', 'getImgApi')
     url = base + api + '?image_id=' + imgId
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False
     if result.text != u"null":
         return result.json()['THUMBNAIL']
     else:
         return ""
Пример #16
0
 def __lastVersion(self,vid):
     api = conf.read_config(conf.path, 'API', 'checkVersionApi2')
     url = base + api
     s = requests.session()
     data = {'id':vid}
     result = s.post(url,data = data)
     s.keep_alive = False 
     if result.text != u"null":
         return result.json()['LASTVERSION']
     else:
         return ""
Пример #17
0
 def __getSequences(self,pid):
     api = conf.read_config(conf.path, 'API', 'sequencesApi')
     url = base + api + pid
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     
     if result.text != u"null":
         return result.json()['SEQUENCENAME']
     else:
         return ""
Пример #18
0
 def __getFile(self,entity_id,entity_type,project_id):
     api = conf.read_config(conf.path, 'API', 'workfileApi')
     url = (base + api + '?entity_id=' + entity_id + 
            '&entity_type=' + entity_type +
            '&project_id=' + project_id)
     s = requests.session()
     result = s.post(url)
     s.keep_alive = False   
     if result.text != u"null":
         return result.json()['VERSION']
     else:
         return ""
Пример #19
0
 def __getTask(self,entity_id,entity_type,uid,pid):
     api = conf.read_config(conf.path, 'API', 'getTaskApi')
     url = (base + api + '?entity_id=' + entity_id + 
         '&entity_type='+ entity_type + 
         '&uid='+ uid + 
         '&project_id=' + pid )
     s = requests.Session()
     result = requests.post(url)
     s.keep_alive = False     
     if result.text != u"null":
         return result.json()['TASKS']
     else:
         return ""
Пример #20
0
# -*- coding: utf-8 -*-
import lib.requests as requests
import conf.config as conf

base = conf.read_config(conf.path, 'API', 'baseUrl')

class Project(object):
    def __getProject(self,uid):
        api = conf.read_config(conf.path, 'API', 'getProjectApi')
        url = base + api + '?user_id=' + uid
        s = requests.session()
        result = s.post(url)
        s.keep_alive = False
        if result.text != u"null":
            return result.json()['PROJECT']
        else:
            return ""
         
    def callService(self,uid):
        return self.__getProject(uid)
    
class SingleProject(object):
    def __getSingleProject(self,pid):
        api = conf.read_config(conf.path, 'API', 'getSingleProjectApi')
        url = base + api + '?project_id=' + pid
        s = requests.session()
        result = s.post(url)
        s.keep_alive = False   
        if result.text != u"null":
            return result.json()['PROJECT']
        else: