#!/usr/bin/python3.4
# -*- coding: utf-8 -*-
'''
Datum: 1 mei 2015
@auteur: jan baarda
'''

# adres van de RESTserver
server = '192.168.2.6'
poort = '8090'

from urllib.parse import urlencode
import httplib2


# create the dictionary of field-value pairs
data = {}
n = 0

while True:
	pass	#ga door tot cntrl c
	# gegevens invoer     
	data['temperatuur'] = input("temperatuur[C]: ") # 1e field-value pair
	data['luchtdruk'] = input("luchtdruk[hPa]: ") # 2e field-value pair

	# aanroep server met POST                                
	h = httplib2.Http('.cache', timeout=1)
	resp, content = h.request('http://'+server+':'+poort+'/form.xtml','POST',urlencode(data))
	
	# show status
	n = n+1
	N = resp.status
	print (n, str(N))
 




