Skip to content

Commit 496d3f8

Browse files
committed
Use separate session for file uploading
1 parent b2e72a3 commit 496d3f8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vk_api/upload.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
:copyright: (c) 2019 python273
77
"""
88

9+
import requests
10+
11+
912
from .vk_api import VkApi, VkApiMethod
1013

1114

@@ -23,7 +26,7 @@ class VkUpload(object):
2326
:param vk: объект :class:`VkApi` или :class:`VkApiMethod`
2427
"""
2528

26-
__slots__ = ('vk',)
29+
__slots__ = ('vk', 'http')
2730

2831
def __init__(self, vk):
2932

@@ -37,9 +40,8 @@ def __init__(self, vk):
3740
else:
3841
self.vk = vk.get_api()
3942

40-
@property
41-
def http(self):
42-
return self.vk._vk.http
43+
self.http = requests.Session()
44+
self.http.headers.pop('user-agent')
4345

4446
def photo(self, photos, album_id,
4547
latitude=None, longitude=None, caption=None, description=None,

0 commit comments

Comments
 (0)