2018-02-11 01:38:38 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-02-10 01:37:10 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Generic TCL request object."""
|
|
|
|
|
2018-02-10 01:37:10 +00:00
|
|
|
from . import tclresult
|
|
|
|
|
2018-02-11 01:38:38 +00:00
|
|
|
|
2018-02-10 01:37:10 +00:00
|
|
|
class TclRequest:
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Generic TCL request object."""
|
|
|
|
|
2018-02-10 01:37:10 +00:00
|
|
|
def __init__(self):
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Populate variables."""
|
2018-02-10 01:37:10 +00:00
|
|
|
self.uri = ""
|
2018-02-10 02:29:36 +00:00
|
|
|
self.rawmode = False
|
2018-02-10 01:37:10 +00:00
|
|
|
self.response = None
|
|
|
|
self.result = None
|
|
|
|
self.error = None
|
|
|
|
self.success = False
|
|
|
|
|
|
|
|
def get_headers(self):
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Return request headers."""
|
2018-02-10 01:37:10 +00:00
|
|
|
return {}
|
|
|
|
|
|
|
|
def get_params(self):
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Return request parameters."""
|
2018-02-10 01:37:10 +00:00
|
|
|
return {}
|
|
|
|
|
|
|
|
def is_done(self, http_status: int, contents: str):
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Check if query is done or needs retry."""
|
2018-02-10 01:37:10 +00:00
|
|
|
return False
|
|
|
|
|
|
|
|
def get_result(self) -> tclresult.TclResult:
|
2018-02-11 01:38:38 +00:00
|
|
|
"""Return Result object."""
|
2018-02-10 01:37:10 +00:00
|
|
|
return self.result
|