def GET(self): c = Crawler('117.102.189.222') ip = str(self._ip()) location = c.location(ip) ua = self._useragent() cookie = Cookie(ua,ip) came = cookie.GET() import time cis = ua + '//' + ip + '//' + str(int(time.time())) if came: print "came: " + cis else: print "first time: " + cis cookie.SET(cis=cis) access.add(location=location,cis=encrypt(cis),action="in") return html % encrypt(cis)
def SET(self,COOKIE_EXPIRE=COOKIE_EXPIRE,**kwargs): for key in kwargs.keys(): web.setcookie(key,encrypt(kwargs[key]),COOKIE_EXPIRE)