Skip to content

Commit 746d429

Browse files
committed
PEP8 and README.md update
1 parent 89cb156 commit 746d429

4 files changed

Lines changed: 12 additions & 16 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
build/
22
*.pyc
3-
.pypirc

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ vk_api - модуль для использования API сайта ВКон
88
Установка
99
------------
1010
$ easy_install vk_api
11-
или
12-
13-
$ pip install git+git://github.com/python273/vk_api.git
1411

1512
Для работы необходим модуль [Requests](https://github.com/kennethreitz/requests)
1613

17-
$ pip install requests
14+
$ easy_install requests

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def main():
2020

2121
values = {
2222
'count': 1 # Получаем только одно сообщение
23-
}
23+
}
2424
response = vk.method('wall.get', values) # С использованием метода wall.get
2525
print response[1]['text'] # Печатаем текст последнего поста со стены
2626

vk_api/vk_api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88

99
class 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

Comments
 (0)