Using Python Script to post data to web server

前端 未结 1 1107
梦如初夏
梦如初夏 2021-02-10 17:20

I am using Python 2.7.3 and I am trying to post data to my local web server. The data I am posting is temperature readings from my raspberry pi. I know the url is right because

1条回答
  •  温柔的废话
    2021-02-10 18:00

    save your time, use this requests lib for httpRequests,

    simple app

    import requests
    
    url = 'http://url.com'
    query = {'field': value}
    res = requests.post(url, data=query)
    print(res.text)
    

    0 讨论(0)
提交回复
热议问题