xhtm 0.8__tar.gz → 0.10__tar.gz
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.
- {xhtm-0.8 → xhtm-0.10}/PKG-INFO +1 -1
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/PKG-INFO +1 -1
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/SOURCES.txt +2 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/attribute.py +1 -1
- xhtm-0.10/xhtml/header/authorization.py +77 -0
- xhtm-0.10/xhtml/header/cookie.py +29 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/header/headers.py +0 -27
- {xhtm-0.8 → xhtm-0.10}/LICENSE +0 -0
- {xhtm-0.8 → xhtm-0.10}/README.md +0 -0
- {xhtm-0.8 → xhtm-0.10}/setup.cfg +0 -0
- {xhtm-0.8 → xhtm-0.10}/setup.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/dependency_links.txt +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/requires.txt +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/top_level.txt +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtm.egg-info/zip-safe +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/element/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/element/attr.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/element/css.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/element/doc.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/element/tag.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/header/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/header/accept.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/header/content.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/locale/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/locale/template.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/resource/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/resource/favicon.ico +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/resource/logo.svg +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/template/__init__.py +0 -0
- {xhtm-0.8 → xhtm-0.10}/xhtml/template/hello.html +0 -0
{xhtm-0.8 → xhtm-0.10}/PKG-INFO
RENAMED
|
@@ -17,7 +17,9 @@ xhtml/element/doc.py
|
|
|
17
17
|
xhtml/element/tag.py
|
|
18
18
|
xhtml/header/__init__.py
|
|
19
19
|
xhtml/header/accept.py
|
|
20
|
+
xhtml/header/authorization.py
|
|
20
21
|
xhtml/header/content.py
|
|
22
|
+
xhtml/header/cookie.py
|
|
21
23
|
xhtml/header/headers.py
|
|
22
24
|
xhtml/locale/__init__.py
|
|
23
25
|
xhtml/locale/template.py
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
class Authorization():
|
|
4
|
+
class Auth():
|
|
5
|
+
def __init__(self, type: str):
|
|
6
|
+
self.__type: str = type
|
|
7
|
+
|
|
8
|
+
@property
|
|
9
|
+
def type(self) -> str:
|
|
10
|
+
return self.__type
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def username(self) -> str:
|
|
14
|
+
return ""
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def password(self) -> str:
|
|
18
|
+
raise NotImplementedError
|
|
19
|
+
|
|
20
|
+
class Basic(Auth):
|
|
21
|
+
TYPE: str = "Basic"
|
|
22
|
+
|
|
23
|
+
def __init__(self, base64: str):
|
|
24
|
+
from base64 import b64decode
|
|
25
|
+
|
|
26
|
+
nameword: str = b64decode(base64).decode("utf-8")
|
|
27
|
+
username, password = nameword.split(":", maxsplit=1)
|
|
28
|
+
self.__username: str = username
|
|
29
|
+
self.__password: str = password
|
|
30
|
+
super().__init__(self.TYPE)
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def username(self) -> str:
|
|
34
|
+
return self.__username
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def password(self) -> str:
|
|
38
|
+
return self.__password
|
|
39
|
+
|
|
40
|
+
class Bearer(Auth):
|
|
41
|
+
TYPE: str = "Bearer"
|
|
42
|
+
|
|
43
|
+
def __init__(self, token: str):
|
|
44
|
+
super().__init__(self.TYPE)
|
|
45
|
+
self.__token = token
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def token(self):
|
|
49
|
+
return self.__token
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def password(self) -> str:
|
|
53
|
+
return self.token
|
|
54
|
+
|
|
55
|
+
class APIKey(Auth):
|
|
56
|
+
TYPE: str = "ApiKey"
|
|
57
|
+
|
|
58
|
+
def __init__(self, key: str):
|
|
59
|
+
super().__init__(self.TYPE)
|
|
60
|
+
self.__key = key
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def key(self):
|
|
64
|
+
return self.__key
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def password(self) -> str:
|
|
68
|
+
return self.key
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def paser(cls, authorization: str) -> Auth:
|
|
72
|
+
k, v = authorization.split(" ", maxsplit=1)
|
|
73
|
+
return {
|
|
74
|
+
cls.Basic.TYPE: cls.Basic,
|
|
75
|
+
cls.Bearer.TYPE: cls.Bearer,
|
|
76
|
+
cls.APIKey.TYPE: cls.APIKey,
|
|
77
|
+
}[k](v)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
from typing import Dict
|
|
4
|
+
from typing import Iterator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Cookies():
|
|
8
|
+
def __init__(self, *cookies: str):
|
|
9
|
+
self.__cookies: Dict[str, str] = {}
|
|
10
|
+
for items in cookies:
|
|
11
|
+
for item in items.split(";"):
|
|
12
|
+
if cookie := item.strip():
|
|
13
|
+
k, v = cookie.split("=", maxsplit=1)
|
|
14
|
+
self.__cookies[k.strip()] = v.strip()
|
|
15
|
+
|
|
16
|
+
def __len__(self) -> int:
|
|
17
|
+
return len(self.__cookies)
|
|
18
|
+
|
|
19
|
+
def __iter__(self) -> Iterator[str]:
|
|
20
|
+
return iter(self.__cookies)
|
|
21
|
+
|
|
22
|
+
def __getitem__(self, key: str) -> str:
|
|
23
|
+
return self.__cookies[key]
|
|
24
|
+
|
|
25
|
+
def __contains__(self, key: str) -> bool:
|
|
26
|
+
return key in self.__cookies
|
|
27
|
+
|
|
28
|
+
def get(self, key: str, default: str = "") -> str:
|
|
29
|
+
return self.__cookies.get(key, default)
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# coding:utf-8
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Dict
|
|
5
|
-
from typing import Iterator
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
class RequestLine():
|
|
@@ -119,28 +117,3 @@ class Headers(Enum):
|
|
|
119
117
|
VARY = "Vary"
|
|
120
118
|
VIA = "Via"
|
|
121
119
|
WARNING = "Warning"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class Cookies():
|
|
125
|
-
def __init__(self, *cookies: str):
|
|
126
|
-
self.__cookies: Dict[str, str] = {}
|
|
127
|
-
for items in cookies:
|
|
128
|
-
for item in items.split(";"):
|
|
129
|
-
if cookie := item.strip():
|
|
130
|
-
k, v = cookie.split("=", maxsplit=1)
|
|
131
|
-
self.__cookies[k.strip()] = v.strip()
|
|
132
|
-
|
|
133
|
-
def __len__(self) -> int:
|
|
134
|
-
return len(self.__cookies)
|
|
135
|
-
|
|
136
|
-
def __iter__(self) -> Iterator[str]:
|
|
137
|
-
return iter(self.__cookies)
|
|
138
|
-
|
|
139
|
-
def __getitem__(self, key: str) -> str:
|
|
140
|
-
return self.__cookies[key]
|
|
141
|
-
|
|
142
|
-
def __contains__(self, key: str) -> bool:
|
|
143
|
-
return key in self.__cookies
|
|
144
|
-
|
|
145
|
-
def get(self, key: str, default: str = "") -> str:
|
|
146
|
-
return self.__cookies.get(key, default)
|
{xhtm-0.8 → xhtm-0.10}/LICENSE
RENAMED
|
File without changes
|
{xhtm-0.8 → xhtm-0.10}/README.md
RENAMED
|
File without changes
|
{xhtm-0.8 → xhtm-0.10}/setup.cfg
RENAMED
|
File without changes
|
{xhtm-0.8 → xhtm-0.10}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|