try auth_url http api mainlink ru start asmx WSDL url http api mainlin

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
try:
auth_url = 'http://api.mainlink.ru/start.asmx?WSDL'
url = 'http://api.mainlink.ru/webmaster.asmx?WSDL'
auth_client = Client(auth_url, proxy=proxy)
cookie = auth_client.service.sys_LogIn(Login=user, Password=password)
cookies = auth_client.options.transport.cookiejar
client = Client(url, proxy=proxy)
client.options.transport.cookiejar = cookies
try:
ok_stat = u"OK"
sleep_stat = u"Sleep"
error_stat = u"NA"
unmoderated_stat = u"Unmoderated"
archived_stat = u"Archived"
wait_stat = u"Wait"
try:
site_stat_ok = client.service.mlapi_GetLinks_byStatus(idsite, ok_stat)
site_stat_ok = len(site_stat_ok[0])
ok = site_stat_ok
except Exception as e:
print str(e)
ok = 0
try:
site_stat_sleep = client.service.mlapi_GetLinks_byStatus(idsite, sleep_stat)
site_stat_sleep = len(site_stat_sleep[0])
sleep = site_stat_sleep
except Exception as e:
print str(e)
sleep = 0
try:
site_stat_error = client.service.mlapi_GetLinks_byStatus(idsite, error_stat)
site_stat_error = len(site_stat_error[0])
error = site_stat_error
except Exception as e:
print str(e)
error = 0
try:
site_stat_unmoderated = client.service.mlapi_GetLinks_byStatus(idsite, unmoderated_stat)
site_stat_unmoderated = len(site_stat_unmoderated[0])
unmoderated = site_stat_unmoderated
except Exception as e:
print str(e)
unmoderated = 0
try:
site_stat_archived = client.service.mlapi_GetLinks_byStatus(idsite, archived_stat)
site_stat_archived = len(site_stat_archived[0])
archived = site_stat_archived
except Exception as e:
print str(e)
archived = 0
try:
site_stat_wait = client.service.mlapi_GetLinks_byStatus(idsite, wait_stat)
site_stat_wait = len(site_stat_wait[0])
wait = site_stat_wait
except Exception as e:
print str(e)
wait = 0
new = 0
print ok
print sleep
print error
print new
print unmoderated
print archived
print wait
except Exception as e:
print str(e)