Esempio n. 1
0
    def login(self, username, password, profiles_cookie, language):
        """
        Выполняет логин к rais и сохраняет полученные cooke

        :param username:
        :type username:
        :param password:
        :type password:
        :param profiles_cookie:
        :type profiles_cookie:
        :param language:
        :type language:
        :return:
        :rtype:
        """
        response = cr.get(url=pi.get_url_host()+'/get_rsid')
        for cookie in response.cookies:
            if cookie.name in 'rsid':
                cookie_domain=cookie.domain
                break
        cookies_jar = response.cookies
        cookies_jar.set('profile', profiles_cookie, domain=cookie_domain)
        pi.set_cookies(cookies_jar)

        params = {
            "login": username,
            "pass" : password,
            "lang" : language
        }
        response_login = cr.post(url=pi.get_url_host() + '/interface/orange/user/login', params=params)
        return response_login
Esempio n. 2
0
 def get_contragent_id(cls, c_a):
     params = {
         "id":
         c_a,
         "with":
         """addresses,aliases,aliases_type,contacts,staffs,bankaccounts,bankaccounts_info,
               contacts_type,addresses_type,requisites,type,flags,flags_type,codes,requisites_files"""
     }
     response = cr.get(url=pi.get_url_host() + '/api/red/contragent/get',
                       params=params)
     return response
Esempio n. 3
0
 def check_availability_foreign_control(self, name_foreign, zs_id):
     params = {
         "with":
         "contragent,type,usagetype_group,spotlinks_spot,rights_territories_territory_aliases,codes",
         "zs_id": zs_id
     }
     response = cr.get(url=pi.get_url_host() +
                       '/api/red/contract/list_foreign_control',
                       params=params)
     for d_l in response.json()["data"]["list"]:
         if name_foreign in d_l["parent_contragent"]["name"]:
             print('Общество ' + name_foreign + ' уже существует')
             return True
     else:
         return False
Esempio n. 4
0
 def check_availability_contract(self, name_contract):
     params = {
         "with": "contragent,type,usagetype_group",
         "limit": 25,
         "page": 1,
         "search_like": name_contract,
         "descendants": 1,
         "kind_id_not": "5a69d5bf-0000-0000-0000-000070eeb9fa"
     }
     response = cr.get(url=pi.get_url_host() + '/api/red/contract/list',
                       params=params)
     r_json = response.json()
     if len(r_json["data"]["list"]) > 0:
         print('Документ ' + name_contract + ' уже существует')
         return True
     else:
         return False
Esempio n. 5
0
 def check_availability(self, name_ip):
     params = {
         "with": "aliases,requisites,type,orgs",
         "total": 0,
         "limit": 25,
         "page": 1,
         "search_blike": name_ip,
         "no_count": 1
     }
     response = cr.get(url=pi.get_url_host() + '/api/red/contragent/list',
                       params=params)
     r_json = response.json()
     if len(r_json["data"]["list"]) > 0:
         print('Заинтересованная сторона ' + name_ip + ' уже существует')
         return r_json["data"]["list"][0]["id"]
     else:
         return False
Esempio n. 6
0
 def society_id(self, society_name):
     society_id = None
     params = {
         "with": "codes",
         "type": 4,
         "limit": 1000,
         "foreign": 1,
         "search_like": society_name
     }
     response = cr.get(url=pi.get_url_host() + '/api/red/contragent/list',
                       params=params)
     r_json = response.json()
     for g_n in r_json["data"]["list"]:
         if society_name in g_n["name"]:
             society_id = g_n["id"]
             break
     return society_id
Esempio n. 7
0
 def document_kind_id(self, kind_name):
     kind_id = None
     params = {
         "category.is_contragent_docs": "true",
         "is_creatable": 1,
         "limit": 500,
         "with": "ckrt"
     }
     response = cr.get(url=pi.get_url_host() +
                       '/api/red/thesaurus/contract/kind/list',
                       params=params)
     r_json = response.json()
     for g_n in r_json["data"]["list"]:
         if (kind_name in g_n["name"]) and (len(kind_name) == len(
                 g_n["name"])):
             kind_id = g_n["id"]
             break
     return kind_id