HTTP post function based on Python 2