'''
Utilities für EHUtil
'''
import syslog
from http import cookies

def schreibe_log(eintrag):
    syslog.openlog("eh_util")
    syslog.syslog(eintrag) 

def write_http_data(key, value):
    cookie = cookies.SimpleCookie()
    cookie[key] = value
    cookie[key]["path"] = "/eh_util"
    print(cookie)

def lese_http_data(key):
    import os
    cookie_string = os.environ.get("HTTP_COOKIE")
    cookie = cookies.SimpleCookie(cookie_string)
    if key in cookie:
        return cookie[key].value
    return None
    #return cookie[key] or None
 