Browse Source

Don't sleep on the last image

main
parent
commit
68ec55fced
  1. 9
      vis.py

9
vis.py

@ -12,7 +12,7 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
'''
import vk_api, os, random, datetime, argparse
import vk_api, os, random, argparse
from vk_api import VkUpload
from time import sleep
@ -48,7 +48,7 @@ def sendImages(img_dir = ".", ID = 0, IS_GROUP_CHAT = False, TOKEN = ""):
upload_img = upload.photo_messages(photos = path_to_image)[0]
# each message will contain "Counter : {number_of_}"
MESSAGE = "▶ Counter ┃{}".format(counter)
MESSAGE = "{}/{}".format(counter, len(files))
# sending
print("{}: Sending {}...".format(counter,filename))
@ -69,10 +69,11 @@ def sendImages(img_dir = ".", ID = 0, IS_GROUP_CHAT = False, TOKEN = ""):
print(e)
continue
counter += 1
if counter < len(files):
# giving API a bit of rest
sleep(random.uniform(3.0,4.0))
counter += 1
pass

Loading…
Cancel
Save