Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading
- from urllib import urlopen
- import json
- f = urlopen('http://fucking-great-advice.ru/api/random')
- s = f.read()
- json_s = json.loads(s)
- #print(json_s['text'])
- import requests
- lock = threading.Lock()
- def get_quote(i):
- f = requests.get('http://fucking-great-advice.ru/api/random')
- json_s = f.json()
- lock.acquire()
- print(str(i)+ ') ' + json_s['text'])
- lock.release()
- thread_list = []
- for i in range(0,10):
- thread_list.append(threading.Thread(target=get_quote, args=(i,)))
- thread_list[i].start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement