77
88
99class VkApi ():
10- def __init__ (self , login = None , password = None , sid = None , token = None ,
11- auth_in_api = True , app_id = 2895443 , scope = 2097151 ,
12- proxies = {}):
10+ def __init__ (self ,
11+ login = None , password = None , auth_in_api = True ,
12+ sid = None , token = None ,
13+ app_id = 2895443 , scope = 2097151 , proxies = {}):
1314
1415 self .login = login
1516 self .password = password
@@ -23,9 +24,8 @@ def __init__(self, login=None, password=None, sid=None, token=None,
2324 self .http = requests .Session ()
2425 self .http .proxies = proxies # Ставим прокси если есть
2526 self .http .headers = { # Притворимся браузером
26- 'User-agent' : 'Opera/9.80 (Windows NT 6.1; WOW64; U; ru) Presto/2.10.289 Version/12.00'
27- }
28- self .http .verify = False # Сертификаты не будем проверять
27+ 'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0'
28+ }
2929
3030 if login and password : # Oh...
3131 self .sid = self .settings ['remixsid' ]
@@ -50,7 +50,7 @@ def vk_login(self, captcha_sid='', captcha_key=''):
5050 'captcha_key' : captcha_key ,
5151 'email' : self .login ,
5252 'pass' : self .password
53- }
53+ }
5454
5555 if 'remixsid' in self .http .cookies :
5656 self .http .cookies .pop ('remixsid' )
@@ -64,7 +64,7 @@ def vk_login(self, captcha_sid='', captcha_key=''):
6464 self .settings ['forapilogin' ] = {
6565 'p' : self .http .cookies ['p' ],
6666 'l' : self .http .cookies ['l' ]
67- }
67+ }
6868
6969 self .sid = remixsid
7070 return True
@@ -80,7 +80,7 @@ def check_sid(self):
8080 'remixsid' : self .sid ,
8181 'remixlang' : '0' ,
8282 'remixsslsid' : '1'
83- })
83+ })
8484
8585 response = self .http .post (url ).json ()
8686
@@ -95,7 +95,7 @@ def api_login(self):
9595 'client_id' : self .app_id ,
9696 'scope' : self .scope ,
9797 'response_type' : 'token' ,
98- }
98+ }
9999
100100 cookies = {}
101101 cookies .update (self .settings ['forapilogin' ])
0 commit comments