coding utf-8 import logging datetime from suds client import Client lo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
import logging, datetime
from suds.client import Client
logging.basicConfig(level = logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
url = 'http://app.opp.tusur.ru/Services/MainContract/MainContractService.asmx?WSDL'
client = Client(url)
response = client.service.Login("login", "password")
#if response.RequestResult == "RequestSuceeded":
# print client
obj_types = client.factory.create('ObjectTypes')
obj_errors = client.factory.create('ObjectErrors')
obj_states = client.factory.create('ObjectStates')
print obj_types, obj_errors, obj_states
lddto = client.factory.create('LastDatesDTO')
lddto.TypeId = -1
lddto.ObjectType = obj_types.Money
lddto.LastDataDate = datetime.date.today() - datetime.timedelta(days=30)
lddto.ObjectError = obj_errors.ObjectValid
lddto.ObjectState = obj_states.Unchanged
print lddto
print client.service.GetLastDataDate([lddto, ] )