Skip to content

Commit 61d7042

Browse files
committed
Pass 429.html
1 parent d5de703 commit 61d7042

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vk_api/vk_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import threading
1414
import time
1515
import urllib.parse
16+
from hashlib import md5
1617

1718
import requests
1819

@@ -255,6 +256,11 @@ def _vk_login(self, captcha_sid=None, captcha_key=None):
255256
# Get cookies
256257
response = self.http.get('https://vk.com/login')
257258

259+
if response.url.startswith('https://vk.com/429.html?'):
260+
hash429_md5 = md5(self.http.cookies['hash429'].encode('ascii')).hexdigest()
261+
self.http.cookies.pop('hash429')
262+
response = self.http.get(f'{response.url}&key={hash429_md5}')
263+
258264
headers = {
259265
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
260266
'Accept-Language': 'en-US,en;q=0.5',
@@ -654,6 +660,7 @@ def method(self, method, values=None, captcha_sid=None, captcha_key=None,
654660
response = self.http.post(
655661
'https://api.vk.com/method/' + method,
656662
values,
663+
headers={'Cookie': ''}
657664
)
658665
self.last_request = time.time()
659666

0 commit comments

Comments
 (0)