Untitled

 avatar
unknown
plain_text
a year ago
1.0 kB
2
Indexable
import sqlite3
import zeep
import secrets
import json


credentials = ("школа","Parsec","12345")
client = zeep.Client("http://172.16.16.5:10101/IntegrationService/IntegrationService.asmx?WSDL")
session = client.service.OpenSession(*credentials)
sessionId = session.Value.SessionID

base = sqlite3.connect('baza.db',check_same_thread=True)
cur = base.cursor()
base.execute('CREATE TABLE IF NOT EXISTS data(last_name,first_name,middle_name,id PRIMARY KEY,id_parents)')
base.commit()



people=client.service.GetOrgUnitsHierarhyWithPersons(sessionId)


for i in range(len(people)):
    people2 = (people[i])
    try:
        if people2['LAST_NAME']:
            cur.execute('INSERT INTO data VALUES(?, ?, ?, ?, ?)',
                        (people2['LAST_NAME'], people2['FIRST_NAME'], people2['MIDDLE_NAME'], people2['ID'], ''))
            base.commit()
            print(people2['LAST_NAME'], "|", people2['FIRST_NAME'], "|", people2['MIDDLE_NAME'], "|", people2['ID'])
        else:
            continue
    except:
        continue
Leave a Comment