Skip to content

Instantly share code, notes, and snippets.

@dca
Created October 12, 2012 00:36
Show Gist options
  • Select an option

  • Save dca/3876643 to your computer and use it in GitHub Desktop.

Select an option

Save dca/3876643 to your computer and use it in GitHub Desktop.
Python - Post with Thread
import urllib2, urllib
import time
from threading import Thread
URL = 'http://#########'
Count = 5
def myfunc(i):
data = {}
f = urllib2.urlopen(
url = URL ,
data = urllib.urlencode(data)
)
print(i)
# f.read()
for i in range(Count):
t = Thread(target=myfunc, args=(i,))
# time.sleep(1)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment