-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsulta2.py
128 lines (119 loc) · 2.72 KB
/
consulta2.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/env python3
import os, re, time, pyautogui, datetime, pyperclip
ahora = datetime.datetime.now()
log= "/usr/share/hassio/homeassistant/pyscript/consulta.csv"
nie='Y0841924T'
exp='R519486'
year='2021'
resp1='error'
resp2='error'
pyautogui.FAILSAFE = False
pyautogui.click(90, 755)
time.sleep(8)
pyautogui.typewrite('https://sede.mjusticia.gob.es/eConsultas/inicioNacionalidad')
pyautogui.press('enter')
time.sleep(10)
pyautogui.typewrite('04')
time.sleep(0.1)
pyautogui.typewrite('29')
time.sleep(0.1)
pyautogui.typewrite('1984')
time.sleep(0.1)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.typewrite(nie)
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.typewrite(exp)
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.typewrite(year)
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('space')
time.sleep(1)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('tab')
time.sleep(0.2)
pyautogui.press('enter')
time.sleep(3)
pyautogui.click(275, 580)
time.sleep(0.2)
pyautogui.dragTo(1000, 620, button='left')
time.sleep(0.2)
pyautogui.hotkey('ctrl', 'c')
resp=pyperclip.paste()
pyautogui.hotkey('alt', 'f4')
resp = resp.split("\n\n")
resp1=resp[0].replace('.', '').strip()
resp2=resp[1].replace('.', '').replace('Su expediente se encuentra ', '').strip()
print(f'{ahora.strftime("%d/%m/%Y")},{resp1},{resp2}\n')
with open(log, "a", encoding="utf-8") as o:
o.write(f'{ahora.strftime("%d/%m/%Y")},{resp1},{resp2}\n')
# o.write(f'{ahora.strftime("%d/%m/%Y")},{ahora.strftime("%H:%M")},{resp}\n')