Skip to content

Commit 76b41fa

Browse files
committed
PEP8
User-agent update
1 parent e3a223d commit 76b41fa

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

vk_api/vk_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import requests
1414
import time
1515

16-
DELAY = 1.0 / 3 # 3 requests per second
16+
DELAY = 0.36 # 3 requests per second
1717
CAPTCHA_ERROR_CODE = 14
1818
NEED_VALIDATION_CODE = 17
1919

@@ -59,8 +59,8 @@ def __init__(self, login=None, password=None, number=None, token=None,
5959
self.http = requests.Session()
6060
self.http.proxies = proxies # Ставим прокси
6161
self.http.headers = { # Притворимся браузером
62-
'User-agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:28.0) ' \
63-
'Gecko/20100101 Firefox/28.0'
62+
'User-agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:30.0) '
63+
'Gecko/20100101 Firefox/30.0'
6464
}
6565
self.http.verify = False
6666

@@ -132,7 +132,7 @@ def vk_login(self, captcha_sid=None, captcha_key=None):
132132
def security_check(self, url=None, response=None):
133133
if url:
134134
response = self.http.get(url)
135-
if not 'security_check' in response.url:
135+
if 'security_check' not in response.url:
136136
return
137137

138138
phone_prefix = regexp(r'label ta_r">(.*?)<',
@@ -199,7 +199,7 @@ def api_login(self):
199199

200200
response = self.http.post(url, values)
201201

202-
if not 'access_token' in response.url:
202+
if 'access_token' not in response.url:
203203
url = regexp(r'location\.href = "(.*?)"\+addr;', response.text)[0]
204204
response = self.http.get(url)
205205

@@ -252,7 +252,7 @@ def method(self, method, values=None, captcha_sid=None, captcha_key=None):
252252
else:
253253
values = {}
254254

255-
if not 'v' in values:
255+
if 'v' not in values:
256256
values.update({'v': self.api_version})
257257

258258
if self.token:

vk_api/vk_tools.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ def get_all(self, method, values=None, max_count=200, key='items'):
4545
offset = 0
4646

4747
while True:
48-
run_code = code_get_all_items % (
49-
max_count, offset, json.dumps(values),
50-
key, method, method
51-
)
48+
run_code = code_get_all_items % (max_count, offset,
49+
json.dumps(values), key,
50+
method, method)
5251

5352
response = self.vk.method('execute', {'code': run_code})
5453

vk_api/vk_upload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def photo(self, photos, album_id,
5353

5454
# Олег Илларионов:
5555
# это не могу к сожалению просто пофиксить
56-
if not 'album_id' in response:
56+
if 'album_id' not in response:
5757
response['album_id'] = response['aid']
5858

5959
response.update({

0 commit comments

Comments
 (0)