def GET(self): try: sql = SqlHelper() inputs = web.input() name = inputs.get('name') proxy = Proxy() proxy.set_value( ip=inputs.get('ip'), port=inputs.get('port'), country=inputs.get('country', None), anonymity=inputs.get('anonymity', None), https=inputs.get('https', 'no'), speed=inputs.get('speed', -1), source=inputs.get('source', name), ) utils.sql_insert_proxy(sql, name, proxy) command = "SELECT ip FROM {0} WHERE ip={1} AND port={2}".format( name, inputs.get('ip'), inputs.get('port')) res = sql.query_one(command) return res is None except: pass return False
def add_proxy(self, proxy): utils.sql_insert_proxy(self.sql, config.free_ipproxy_table, proxy)