I have a Webservice wich is reachable over a URL and I have a Raspberry with different sensors wich measures the temperature and co2.Now I want to write a Python script to send this values to the Webserver.
2 Answers
Take a look at python-requests API. It's readily available as a dpkg package on raspberry pi's repos. http://docs.python-requests.org/en/master/
Assuming your web service is expecting a GET request with data passed as query string parameters, you would do something like this:
import requests
payload = {'sensor': 'temp1', 'temperature': 32}
response = requests.get('https://server.example.com/webservice/endpoint', params=payload)
Similar with a POST request to an endpoint expecting JSON encoded data:
response = requests.post('https://server.example.com/webservice/endpoint2', json=payload)
Tell us more about the webservice and I will edit the answer accordingly.