Advertisement
Guest User

Untitled

a guest
May 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import requests
  3. import time
  4. import json
  5.  
  6. id = 'user_id='
  7. token = "access_token=c66defb29fed8dca31548aa6447d24a7d58747b3280583ef59c3c5fb0b865875f0bffb8fe7a92c8d604d0"
  8. messagesget = "messages.get"
  9. messagessend = 'messages.send'
  10. requestget = "https://api.vk.com/method/" + messagesget + "?" +'out=0&count=1'+ "&" + token
  11. for i in range(100):
  12. r = requests.get(requestget)
  13. r_json = json.loads(r.text)
  14. idacc=(r_json['response'][1]['uid'])
  15. idacc= str(idacc)
  16. requestsend = "https://api.vk.com/method/" + messagessend + "?" +id+idacc+ "&"+'message=ok'+'&'+ token
  17. print(r_json)
  18. if 'Ping' in (r_json['response'][1]['body']):
  19. s = requests.get(requestsend)
  20. time.sleep(1)
  21. else:
  22. time.sleep(0.5)
  23.  
  24. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement