forked from jjlopez/descargar-cfdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Header.py
38 lines (35 loc) · 1.35 KB
/
Header.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
class Header:
def __init__(self):
self.__user_agent = ('Mozilla/5.0 '
'(Windows NT 6.1; WOW64; Trident/7.0; AS; '
'rv:11.0) like Gecko')
self.__accept = ('text/html,application/xhtml+xml,application/xml;'
'q=0.9,*/*;q=0.8')
def obtener(self, host, referer):
encabezado = {
'Accept': self.__accept,
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'keep-alive',
'Host': host,
'Referer': referer,
'User-Agent': self.__user_agent,
'Content-Type': 'application/x-www-form-urlencoded',
}
return encabezado
def obtener_ajax(self, host, referer):
encabezado = {
'Accept': self.__accept,
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.5',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Host': host,
'Referer': referer,
'User-Agent': self.__user_agent,
'Content-Type': 'application/x-www-form-urlencoded',
'X-MicrosoftAjax': 'Delta=true',
'x-requested-with': 'XMLHttpRequest',
'Pragma': 'no-cache'
}
return encabezado