Python.
Вместо многопоточности можно использовать grequests - это библиотека requests на основе gevent т.е. non blocking I/O.
А если многопоточность то:
вот однопоточный пример.
import requests
filename='test_file'
f = open (filename)
r = requests.post(url='http://upload.example.com', data = {'title':'test_file}, files = {'file':f})
print r.status_code
print r.headers
manual по библиотеке requests
docs.python-requests.org/en/latest/index.html
пример многопоточности
import threading
from random import randint
from time import sleep
def printNumber(number):
# Sleeps a random 1 to 10 seconds
sleep(randint(1,10))
print str(number)
thread_list = []
for i in range(1,10):
# Instatiates the thread
# (i) does not make a sequence, so (i,)
t = threading.Thread(target=printNumber, args=(i,))
# Sticks the thread in a list so that it remains accessible
thread_list.append(t)
# Starts threads
for thread in thread_list:
thread.start()
# This blocks the calling thread until the thread whose join() method is called is terminated.
# From http://docs.python.org/2/library/threading.html#thread-objects
for thread in thread_list:
thread.join()
# Demonstrates that the main process waited for threads to complete
print "Done"