qtoggleserver-generic-http 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qtoggleserver/generichttp/__init__.py +6 -0
- qtoggleserver/generichttp/client.py +164 -0
- qtoggleserver/generichttp/ports.py +111 -0
- qtoggleserver_generic_http-1.2.0.dist-info/METADATA +177 -0
- qtoggleserver_generic_http-1.2.0.dist-info/RECORD +8 -0
- qtoggleserver_generic_http-1.2.0.dist-info/WHEEL +5 -0
- qtoggleserver_generic_http-1.2.0.dist-info/licenses/LICENSE.txt +177 -0
- qtoggleserver_generic_http-1.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import aiohttp
|
|
6
|
+
import jinja2.nativetypes
|
|
7
|
+
|
|
8
|
+
from qtoggleserver.core import ports as core_ports
|
|
9
|
+
from qtoggleserver.lib import polled
|
|
10
|
+
from qtoggleserver.utils import json as json_utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
DEFAULT_TIMEOUT = 10 # seconds
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class GenericHTTPClient(polled.PolledPeripheral):
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
*,
|
|
22
|
+
read: dict[str, Any],
|
|
23
|
+
write: dict[str, Any] | None = None,
|
|
24
|
+
auth: dict[str, Any] | None = None,
|
|
25
|
+
ignore_response_code: bool = False,
|
|
26
|
+
ignore_invalid_cert: bool = False,
|
|
27
|
+
timeout: int = DEFAULT_TIMEOUT,
|
|
28
|
+
ports: dict[str, dict[str, Any]],
|
|
29
|
+
**kwargs,
|
|
30
|
+
) -> None:
|
|
31
|
+
self.read_details: dict[str, Any] = read
|
|
32
|
+
self.read_details.setdefault("method", "GET")
|
|
33
|
+
|
|
34
|
+
self.write_details: dict[str, Any] = write or {}
|
|
35
|
+
self.write_details.setdefault("url", self.read_details.get("url"))
|
|
36
|
+
self.write_details.setdefault("method", "POST")
|
|
37
|
+
|
|
38
|
+
self.auth: dict[str, str] = auth or {}
|
|
39
|
+
self.auth.setdefault("type", "none")
|
|
40
|
+
self.ignore_response_code: bool = ignore_response_code
|
|
41
|
+
self.ignore_invalid_cert: bool = ignore_invalid_cert
|
|
42
|
+
self.timeout: int = timeout
|
|
43
|
+
self.port_details: dict[str, dict[str, Any]] = ports
|
|
44
|
+
|
|
45
|
+
self.last_response_status: int | None = None
|
|
46
|
+
self.last_response_body: str | None = None
|
|
47
|
+
self.last_response_json: Any | None = None
|
|
48
|
+
self.last_response_headers: dict[str, Any] | None = None
|
|
49
|
+
|
|
50
|
+
self._j2env: jinja2.nativetypes.NativeEnvironment = jinja2.nativetypes.NativeEnvironment(enable_async=True)
|
|
51
|
+
self._j2env.globals.update(__builtins__)
|
|
52
|
+
|
|
53
|
+
super().__init__(**kwargs)
|
|
54
|
+
|
|
55
|
+
async def make_port_args(self) -> list[dict[str, Any] | type[core_ports.BasePort]]:
|
|
56
|
+
from .ports import GenericHTTPPort
|
|
57
|
+
|
|
58
|
+
port_args = []
|
|
59
|
+
for id_, details in self.port_details.items():
|
|
60
|
+
port_args.append({"driver": GenericHTTPPort, "id": id_, **details})
|
|
61
|
+
|
|
62
|
+
return port_args
|
|
63
|
+
|
|
64
|
+
async def poll(self) -> None:
|
|
65
|
+
self.debug("read request %s %s", self.read_details["method"], self.read_details["url"])
|
|
66
|
+
|
|
67
|
+
async with aiohttp.ClientSession() as session:
|
|
68
|
+
request_params = await self.prepare_request(self.read_details, {})
|
|
69
|
+
async with session.request(**request_params) as response:
|
|
70
|
+
data = await response.read()
|
|
71
|
+
|
|
72
|
+
self.last_response_body = data.decode()
|
|
73
|
+
self.last_response_status = response.status
|
|
74
|
+
self.last_response_headers = dict(response.headers)
|
|
75
|
+
|
|
76
|
+
# Attempt to decode JSON but don't worry at all if that is not possible
|
|
77
|
+
try:
|
|
78
|
+
self.last_response_json = json_utils.loads(self.last_response_body)
|
|
79
|
+
except Exception:
|
|
80
|
+
self.last_response_json = None
|
|
81
|
+
|
|
82
|
+
async def write_port_value(
|
|
83
|
+
self, port: core_ports.BasePort, request_details: dict[str, Any], context: dict[str, Any]
|
|
84
|
+
) -> None:
|
|
85
|
+
details = request_details
|
|
86
|
+
for k, v in self.write_details.items():
|
|
87
|
+
details.setdefault(k, v)
|
|
88
|
+
|
|
89
|
+
context = dict(context, **(await self.get_placeholders_context(port)))
|
|
90
|
+
|
|
91
|
+
async with aiohttp.ClientSession() as session:
|
|
92
|
+
request_params = await self.prepare_request(details, context)
|
|
93
|
+
self.debug("write request %s %s", request_params["method"], request_params["url"])
|
|
94
|
+
async with session.request(**request_params) as response:
|
|
95
|
+
try:
|
|
96
|
+
_ = await response.read()
|
|
97
|
+
except Exception as e:
|
|
98
|
+
self.error("write request failed: %s", e, exc_info=True)
|
|
99
|
+
|
|
100
|
+
if response.status != 200 and not self.ignore_response_code:
|
|
101
|
+
raise core_ports.PortWriteError("Write request failed with status code %d" % response.status)
|
|
102
|
+
|
|
103
|
+
# TODO: remove me after `PolledPeripheral` gets an option to do this kind of polling after write
|
|
104
|
+
await self.poll()
|
|
105
|
+
|
|
106
|
+
async def prepare_request(self, details: dict[str, Any], context: dict[str, Any]) -> dict[str, Any]:
|
|
107
|
+
headers = details.get("headers", {})
|
|
108
|
+
request_body = details.get("request_body")
|
|
109
|
+
if request_body is not None:
|
|
110
|
+
request_body = await self.replace_placeholders_rec(request_body, context)
|
|
111
|
+
|
|
112
|
+
if request_body is not None and not isinstance(request_body, str): # assuming JSON body
|
|
113
|
+
request_body = json_utils.dumps(request_body)
|
|
114
|
+
headers.setdefault("Content-Type", "application/json")
|
|
115
|
+
|
|
116
|
+
auth = None
|
|
117
|
+
if self.auth["type"] == "basic":
|
|
118
|
+
auth = aiohttp.BasicAuth(self.auth.get("username", ""), self.auth.get("password", ""))
|
|
119
|
+
|
|
120
|
+
url = details["url"]
|
|
121
|
+
if details.get("query"):
|
|
122
|
+
# Don't use `urlencode` because we don't want our special characters to be encoded, as they might be part
|
|
123
|
+
# of a template.
|
|
124
|
+
query_str = "&".join(f"{k}={v}" for k, v in details["query"].items())
|
|
125
|
+
url = url + "?" + query_str
|
|
126
|
+
url = await self.replace_placeholders_rec(url, context)
|
|
127
|
+
|
|
128
|
+
d = {"method": details["method"], "url": url, "ssl": not self.ignore_invalid_cert, "timeout": self.timeout}
|
|
129
|
+
|
|
130
|
+
if "params" in details:
|
|
131
|
+
d["params"] = await self.replace_placeholders_rec(details["params"], context)
|
|
132
|
+
|
|
133
|
+
if headers:
|
|
134
|
+
d["headers"] = await self.replace_placeholders_rec(headers, context)
|
|
135
|
+
|
|
136
|
+
if "cookies" in details:
|
|
137
|
+
d["cookies"] = await self.replace_placeholders_rec(details["cookies"], context)
|
|
138
|
+
|
|
139
|
+
if request_body is not None:
|
|
140
|
+
d["data"] = request_body
|
|
141
|
+
|
|
142
|
+
if auth:
|
|
143
|
+
d["auth"] = auth
|
|
144
|
+
|
|
145
|
+
return d
|
|
146
|
+
|
|
147
|
+
async def get_placeholders_context(self, port: core_ports.BasePort) -> dict[str, Any]:
|
|
148
|
+
context = {"port": port, "value": port.get_last_read_value(), "attrs": await port.get_attrs()}
|
|
149
|
+
|
|
150
|
+
return context
|
|
151
|
+
|
|
152
|
+
async def replace_placeholders_rec(self, obj: Any, context: dict[str, Any]) -> Any:
|
|
153
|
+
if isinstance(obj, dict):
|
|
154
|
+
return {
|
|
155
|
+
await self.replace_placeholders_rec(k, context): await self.replace_placeholders_rec(v, context)
|
|
156
|
+
for k, v in obj.items()
|
|
157
|
+
}
|
|
158
|
+
elif isinstance(obj, list):
|
|
159
|
+
return [await self.replace_placeholders_rec(e, context) for e in obj]
|
|
160
|
+
elif isinstance(obj, str):
|
|
161
|
+
template = self._j2env.from_string(obj)
|
|
162
|
+
return await template.render_async(context)
|
|
163
|
+
else:
|
|
164
|
+
return obj
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from typing import Any, cast
|
|
4
|
+
|
|
5
|
+
import jsonpointer
|
|
6
|
+
|
|
7
|
+
from qtoggleserver.core import ports as core_ports
|
|
8
|
+
from qtoggleserver.core.typing import NullablePortValue
|
|
9
|
+
from qtoggleserver.lib import polled
|
|
10
|
+
|
|
11
|
+
from .client import GenericHTTPClient
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class GenericHTTPPort(polled.PolledPort):
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
*,
|
|
18
|
+
id: str,
|
|
19
|
+
type: str = core_ports.TYPE_BOOLEAN,
|
|
20
|
+
writable: bool = False,
|
|
21
|
+
read: dict[str, Any],
|
|
22
|
+
write: dict[str, Any] | None = None,
|
|
23
|
+
**kwargs,
|
|
24
|
+
) -> None:
|
|
25
|
+
# These will directly determine the port type attribute
|
|
26
|
+
self._type = type
|
|
27
|
+
self._writable = writable
|
|
28
|
+
|
|
29
|
+
self._write_details: dict[str, Any] = write or {}
|
|
30
|
+
|
|
31
|
+
json_path = read.get("json_path")
|
|
32
|
+
body_regex = read.get("body_regex")
|
|
33
|
+
true_value = read.get("true_value", True)
|
|
34
|
+
false_value = read.get("false_value", False)
|
|
35
|
+
|
|
36
|
+
self._json_path: str | None = json_path
|
|
37
|
+
self._body_regex: re.Pattern | None = re.compile(body_regex) if body_regex else None
|
|
38
|
+
self._true_values: list[Any] = true_value if isinstance(true_value, list) else [true_value]
|
|
39
|
+
self._false_values: list[Any] = false_value if isinstance(false_value, list) else [false_value]
|
|
40
|
+
|
|
41
|
+
super().__init__(id=id, **kwargs)
|
|
42
|
+
|
|
43
|
+
def get_peripheral(self) -> GenericHTTPClient:
|
|
44
|
+
return cast(GenericHTTPClient, super().get_peripheral())
|
|
45
|
+
|
|
46
|
+
async def read_value(self) -> NullablePortValue:
|
|
47
|
+
client = self.get_peripheral()
|
|
48
|
+
|
|
49
|
+
if client.last_response_status is None:
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
if not client.ignore_response_code and client.last_response_status >= 400:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
# JSON pointer lookup
|
|
56
|
+
if self._json_path:
|
|
57
|
+
if client.last_response_json is None: # not a JSON response
|
|
58
|
+
return None
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
raw_value = jsonpointer.resolve_pointer(client.last_response_json, self._json_path)
|
|
62
|
+
except jsonpointer.JsonPointerException:
|
|
63
|
+
# Return value unavailable when JSON pointer cannot be resolved instead of propagating the exception
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
# Regex pattern match
|
|
67
|
+
elif self._body_regex:
|
|
68
|
+
match = self._body_regex.match(client.last_response_body)
|
|
69
|
+
if match is None:
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
raw_value = match.group(1)
|
|
74
|
+
except IndexError:
|
|
75
|
+
raw_value = match.group()
|
|
76
|
+
|
|
77
|
+
# Value determined by status code
|
|
78
|
+
else:
|
|
79
|
+
raw_value = client.last_response_status < 300
|
|
80
|
+
|
|
81
|
+
if self._type == core_ports.TYPE_BOOLEAN:
|
|
82
|
+
if self._true_values:
|
|
83
|
+
return raw_value in self._true_values
|
|
84
|
+
elif self._false_values:
|
|
85
|
+
return raw_value not in self._false_values
|
|
86
|
+
else:
|
|
87
|
+
return bool(raw_value)
|
|
88
|
+
else:
|
|
89
|
+
if isinstance(raw_value, bool):
|
|
90
|
+
return int(raw_value)
|
|
91
|
+
elif isinstance(raw_value, str):
|
|
92
|
+
raw_value = raw_value.strip()
|
|
93
|
+
factor = 1
|
|
94
|
+
if raw_value.endswith("%"):
|
|
95
|
+
raw_value = raw_value.strip("%")
|
|
96
|
+
factor = 0.01
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
return int(raw_value) * factor
|
|
100
|
+
except ValueError:
|
|
101
|
+
try:
|
|
102
|
+
return float(raw_value) * factor
|
|
103
|
+
except ValueError:
|
|
104
|
+
return None
|
|
105
|
+
elif isinstance(raw_value, (int, float)):
|
|
106
|
+
return raw_value
|
|
107
|
+
else:
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
async def write_value(self, value: NullablePortValue) -> None:
|
|
111
|
+
await self.get_peripheral().write_port_value(self, self._write_details, context={"new_value": value})
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qtoggleserver-generic-http
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: qToggleServer ports backed by configurable HTTP requests
|
|
5
|
+
Author-email: Calin Crisan <ccrisan@gmail.com>
|
|
6
|
+
License: Apache 2.0
|
|
7
|
+
Requires-Python: ==3.10.*
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Requires-Dist: aiohttp
|
|
11
|
+
Requires-Dist: jinja2
|
|
12
|
+
Requires-Dist: jsonpointer
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
## About
|
|
16
|
+
|
|
17
|
+
This is an addon for [qToggleServer](https://github.com/qtoggle/qtoggleserver).
|
|
18
|
+
|
|
19
|
+
It provides ports that are backed by configurable HTTP requests.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
Install using pip:
|
|
25
|
+
|
|
26
|
+
pip install qtoggleserver-generic-http
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
##### `qtoggleserver.conf:`
|
|
32
|
+
``` ini
|
|
33
|
+
...
|
|
34
|
+
peripherals = [
|
|
35
|
+
...
|
|
36
|
+
{
|
|
37
|
+
driver = "qtoggleserver.generichttp.GenericHTTPClient"
|
|
38
|
+
name = "myperipheral" # a name of your choice
|
|
39
|
+
read = {
|
|
40
|
+
url = "https://api.example.com/myresource"
|
|
41
|
+
method = GET # default
|
|
42
|
+
query = {
|
|
43
|
+
name1 = "value1"
|
|
44
|
+
...
|
|
45
|
+
}
|
|
46
|
+
headers = {
|
|
47
|
+
name2 = "value2"
|
|
48
|
+
...
|
|
49
|
+
}
|
|
50
|
+
cookies = {
|
|
51
|
+
name3 = "value3"
|
|
52
|
+
...
|
|
53
|
+
}
|
|
54
|
+
request_body = { # JSON or custom body string content
|
|
55
|
+
"name4": "value4"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
write = {
|
|
59
|
+
url = "https://api.example.com/myresource" # inherited from read, if unspecified
|
|
60
|
+
method = POST # default
|
|
61
|
+
query = {
|
|
62
|
+
name1 = "value1"
|
|
63
|
+
...
|
|
64
|
+
}
|
|
65
|
+
headers = {
|
|
66
|
+
name2 = "value2"
|
|
67
|
+
...
|
|
68
|
+
}
|
|
69
|
+
cookies = {
|
|
70
|
+
name3 = "value3"
|
|
71
|
+
...
|
|
72
|
+
}
|
|
73
|
+
request_body = { # JSON or custom body string content
|
|
74
|
+
"name4": "value4"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
auth = {
|
|
78
|
+
type = basic # none (default) or basic
|
|
79
|
+
username = "your_username"
|
|
80
|
+
password = "your_password"
|
|
81
|
+
}
|
|
82
|
+
ignore_response_code = true # see below, defaults to false
|
|
83
|
+
ignore_invalid_cert = true # whether to ignore TLS cerfificate issues or not, defaults to false
|
|
84
|
+
timeout = 10 # default request timeout is 10 seconds
|
|
85
|
+
ports = {
|
|
86
|
+
"port_id1" = {
|
|
87
|
+
type = boolean # boolean or number
|
|
88
|
+
writable = true # defaults to false
|
|
89
|
+
read = {
|
|
90
|
+
json_path = "/path/to/field" # RFC6901 JSON pointer to port value, inside response body
|
|
91
|
+
body_regex = "myvalue=(\d+)" # regular expression inside body for port value lookup
|
|
92
|
+
true_value = 1 # value or list of values that are true (for boolean ports)
|
|
93
|
+
false_value = 1 # value or list of values that are false (for boolean ports)
|
|
94
|
+
}
|
|
95
|
+
write = {
|
|
96
|
+
... # overrides to common write details above
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
...
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
...
|
|
103
|
+
]
|
|
104
|
+
...
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Placeholders
|
|
108
|
+
|
|
109
|
+
Placeholders are based on the [Jinja2](https://jinja.palletsprojects.com/) template rendering engine.
|
|
110
|
+
|
|
111
|
+
Any of the following fields may be given as templates containing _placeholders_:
|
|
112
|
+
* `url`
|
|
113
|
+
* `query`
|
|
114
|
+
* `headers`
|
|
115
|
+
* `cookies`
|
|
116
|
+
* `request_body`
|
|
117
|
+
|
|
118
|
+
The following context variables are recognized when replacing placeholders:
|
|
119
|
+
* `value` - the current port value
|
|
120
|
+
* `new_value` - the new port value, available only when writing a value to port
|
|
121
|
+
* `port` - the port itself
|
|
122
|
+
* `attrs` - a dictionary with current port's attributes
|
|
123
|
+
|
|
124
|
+
Complex data structures containing lists or dictionaries will be parsed recursively and placeholders will be replaced
|
|
125
|
+
in each element or key.
|
|
126
|
+
|
|
127
|
+
For example, following request body will send the new value in a dictionary field called `"value"`:
|
|
128
|
+
|
|
129
|
+
request_body = {
|
|
130
|
+
"value": "{{new_value}}"
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
All builtin Python functions are available to be used inside the placeholder expression. For more details, see the
|
|
134
|
+
[Jinja2 Template Designer Docs](https://jinja.palletsprojects.com/en/2.11.x/templates/).
|
|
135
|
+
|
|
136
|
+
Template strings containing placeholders must be enclosed in quotes. However, their final value will not be surrounded
|
|
137
|
+
by quotes unless it's a string itself.
|
|
138
|
+
|
|
139
|
+
If you really want quotes around your placeholder's real value, you can simply ensure that the final value is a string,
|
|
140
|
+
by passing it to the builtin Python function `str` (e.g. `{{str(new_value)}}`).
|
|
141
|
+
|
|
142
|
+
### Port Value Readings
|
|
143
|
+
|
|
144
|
+
Port values are read using the response to an HTTP request (one request for all defined ports). Intermediate
|
|
145
|
+
_raw values_ are determined from the response and are coerced to the data types of the respective ports.
|
|
146
|
+
|
|
147
|
+
A raw value is determined as follows:
|
|
148
|
+
* if `ignore_response_code` is `false` (default) and status code is >= 400, the raw value is set to `false`, regardless
|
|
149
|
+
of the response body
|
|
150
|
+
* otherwise, if `json_path` is specified, response body is interpreted as JSON and the raw value is looked up using
|
|
151
|
+
given JSON path (RFC6901 JSON pointer); if the lookup does not go well (for any reason), the raw value is _undefined_
|
|
152
|
+
* otherwise, if `body_regex` is specified, a regex match is attempted on the entire body content; the first group (or
|
|
153
|
+
the entire match, if no group is given) is used to determine the raw value; on unsuccessful match, the raw value is
|
|
154
|
+
_undefined_
|
|
155
|
+
* otherwise, the raw value is set to `true` if status code is < 300 and to `false` otherwise (3xx status codes will be
|
|
156
|
+
used internally by the HTTP client)
|
|
157
|
+
|
|
158
|
+
Now given a raw value, the actual port value is determined as follows:
|
|
159
|
+
* if the raw value is _undefined_, the port value becomes _undefined_
|
|
160
|
+
* for a `boolean` port, the value is `true` if the raw value is equal to `true_value` (or one of its items if
|
|
161
|
+
`true_value` is a list) and `false` otherwise
|
|
162
|
+
* for a `number` port, the raw value is transformed to a number, unless it already is a number, as follows:
|
|
163
|
+
* `true` is `1` and `false` is `0`
|
|
164
|
+
* strings are converted to numbers, after being stripped of leading and trailing whitespace
|
|
165
|
+
* any other raw value type will result in an _undefined_ port value
|
|
166
|
+
|
|
167
|
+
### Port Value Writings
|
|
168
|
+
|
|
169
|
+
Writing port values is done using an HTTP request whose response is ignored (but awaited, up to the given `timeout`).
|
|
170
|
+
|
|
171
|
+
As opposed to port readings, there will be one separate request for each port whose value changes.
|
|
172
|
+
|
|
173
|
+
### A Few Remarks
|
|
174
|
+
|
|
175
|
+
If the request body is not given as a string, it is assumed to be JSON and transmitted as such, including the
|
|
176
|
+
corresponding `Content-Type` header set to `application/json`.
|
|
177
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
qtoggleserver/generichttp/__init__.py,sha256=-CQ4PfQCg5UkGNFowIwirOFlFgzUvU6Dgc6hZAQyaZQ,91
|
|
2
|
+
qtoggleserver/generichttp/client.py,sha256=z3DQ_ihyM6S9O4Vkaab_WDHQXGI-hpjMdzMI5H9RQlc,6596
|
|
3
|
+
qtoggleserver/generichttp/ports.py,sha256=_BAVHUbf52JnXRakc9Ioo6zvAzfaKkTBB6uTrmJ-Qtc,3814
|
|
4
|
+
qtoggleserver_generic_http-1.2.0.dist-info/licenses/LICENSE.txt,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
|
|
5
|
+
qtoggleserver_generic_http-1.2.0.dist-info/METADATA,sha256=4BmkRl4w27QlXb52lJsP1w4GTqzhbMCjTCUNmQwYV24,6643
|
|
6
|
+
qtoggleserver_generic_http-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
qtoggleserver_generic_http-1.2.0.dist-info/top_level.txt,sha256=AxqIsa5NJ41k-CcSQe8yIYEzs0LR-WIqbFl9kclKQBw,14
|
|
8
|
+
qtoggleserver_generic_http-1.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
qtoggleserver
|