import urllib2 import threading url https some http site def open_http

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
>>> import urllib2
>>> import threading
>>> url = "https://some.http.site/"
>>> def open_https(n=1):
... for i in xrange(n):
... z = urllib2.urlopen(url).read()
... print i, len(z)
...
>>> threading.Thread(target=open_https, args=(5,)).start()
>>> threading.Thread(target=open_https, args=(5,)).start()
0 18386
0 18386
1 18386
1 18386
2 18386
2 18386
3 18386
3 18386
4 18386
4 18386