Помогите плиз. Пытаюсь скачат фотки из вк, но токен выдаёт ошибку. Вот скрипт:
import requests, json, time, os
VK_USER_ID =
VK_TOKEN = vk1.a.k5KkfVk7fRz4UI1zri1JehT_YbjIhlaQ64EnpwSNZ1sTxuGn75qDCTy6zWWZu1JvcIfDBAiRGAqAp8Vm3xHqYDsXL3NySpc3g51K_3SFfbCNkHLsCy-GTrdqrSWFx9DqyBJzDL4y
def get_foto_data(offset=0, count=50):
api = requests.get("https://api.vk.com/method/photos.getAll", params={
‘owner_id’: VK_USER_ID,
‘access_token’: VK_TOKEN,
‘offset’: offset,
‘count’: count,
‘photo_sizes’: 0,
‘v’: 5.131
})
return json.loads(api.text)
def get_foto():
data = get_foto_data()
count_foto = data
i = 0
count = 50
fotos =
while i <= count_foto:
if i != 0:
data = get_foto_data(offset=i, count=count)
for files in data:
file_url = files
filename = file_url.split(“/”)
fotos.append(filename)
time.sleep(0.1)
api = requests.get(file_url)
with open(“Python39/images/” % filename, “wb”) as file:
file.write(api.content)
print(i)
i += count
print(len(fotos))
def main():
get_foto()
if __name__ == “__main__”:
main()
а вот ошибка:
Traceback (most recent call last):
File “C:\Python39\images\1.py”, line 4, in <module>
VK_TOKEN = vk1.a.k5KkfVk7fRz4UI1zri1JehT_YbjIhlaQ64EnpwSNZ1sTxuGn75qDCTy6zWWZu1JvcIfDBAiRGAqAp8Vm3xHqYDsXL3NySpc3g51K_3SFfbCNkHLsCy-GTrdqrSWFx9DqyBJzDL4y
NameError: name ‘vk1’ is not defined
Можно ли это исправить, добрые люди? Спасибо заранее.