1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-14 00:06:46 +00:00
tcl_ota_check/tcllib/requests/tclrequest.py

36 lines
800 B
Python
Raw Normal View History

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 = ""
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