babyweb 0.1.1.9__py3-none-any.whl → 0.1.3__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.
- babyweb/requesters.py +6 -8
- babyweb/response.py +2 -1
- babyweb/version.py +1 -1
- {babyweb-0.1.1.9.dist-info → babyweb-0.1.3.dist-info}/METADATA +2 -2
- {babyweb-0.1.1.9.dist-info → babyweb-0.1.3.dist-info}/RECORD +8 -8
- {babyweb-0.1.1.9.dist-info → babyweb-0.1.3.dist-info}/LICENSE +0 -0
- {babyweb-0.1.1.9.dist-info → babyweb-0.1.3.dist-info}/WHEEL +0 -0
- {babyweb-0.1.1.9.dist-info → babyweb-0.1.3.dist-info}/top_level.txt +0 -0
babyweb/requesters.py
CHANGED
|
@@ -35,21 +35,19 @@ def parse_url_parts(host, path, port, protocol):
|
|
|
35
35
|
port = protocol == "https" and 443 or 80
|
|
36
36
|
return host, path, port, protocol
|
|
37
37
|
|
|
38
|
-
def fetch(host, path="/", port=None, asjson=False, cb=None, timeout=1, asyn=False, protocol="http", ctjson=False, qsp=None, fakeua=False, retries=5):
|
|
38
|
+
def fetch(host, path="/", port=None, asjson=False, cb=None, timeout=1, asyn=False, protocol="http", ctjson=False, qsp=None, fakeua=False, retries=5, headers={}):
|
|
39
39
|
host, path, port, protocol = parse_url_parts(host, path, port, protocol)
|
|
40
40
|
if qsp:
|
|
41
41
|
path += "?"
|
|
42
42
|
for k, v in list(qsp.items()):
|
|
43
43
|
path += "%s=%s&"%(k, v)
|
|
44
44
|
path = path[:-1]
|
|
45
|
-
gkwargs = {}
|
|
46
|
-
headers = {}
|
|
45
|
+
gkwargs = { "headers": headers }
|
|
47
46
|
if fakeua:
|
|
48
47
|
if type(fakeua) is str:
|
|
49
48
|
headers['User-Agent'] = fakeua
|
|
50
49
|
else:
|
|
51
50
|
headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36'
|
|
52
|
-
gkwargs["headers"] = headers
|
|
53
51
|
if asyn or cb: # asyn w/o cb works, will just log
|
|
54
52
|
secure = protocol == "https"
|
|
55
53
|
if ctjson:
|
|
@@ -62,18 +60,18 @@ def fetch(host, path="/", port=None, asjson=False, cb=None, timeout=1, asyn=Fals
|
|
|
62
60
|
log("fetch %s"%(furl,))
|
|
63
61
|
return syncreq(furl, "get", asjson, ctjson, retries, gkwargs)
|
|
64
62
|
|
|
65
|
-
def post(host, path="/", port=
|
|
63
|
+
def post(host, path="/", port=None, data=None, protocol="http", asjson=False, ctjson=False, text=None, cb=None, headers={}):
|
|
64
|
+
host, path, port, protocol = parse_url_parts(host, path, port, protocol)
|
|
66
65
|
if ctjson:
|
|
67
66
|
data = rec_conv(data)
|
|
68
67
|
if cb:
|
|
69
68
|
if ctjson:
|
|
70
69
|
orig_cb = cb
|
|
71
70
|
cb = lambda v : orig_cb(_ctjson(v))
|
|
72
|
-
host, path, port, protocol
|
|
73
|
-
return dpost(host, path, port, protocol == "https", data=data, text=text, cb=cb)
|
|
71
|
+
return dpost(host, path, port, protocol == "https", headers, data, text, cb)
|
|
74
72
|
url = "://" in host and host or "%s://%s:%s%s"%(protocol, host, port, path)
|
|
75
73
|
log("post %s"%(url,))
|
|
76
|
-
kwargs = {}
|
|
74
|
+
kwargs = { "headers": headers }
|
|
77
75
|
if data:
|
|
78
76
|
kwargs["json"] = data
|
|
79
77
|
elif text:
|
babyweb/response.py
CHANGED
|
@@ -10,6 +10,7 @@ def read_file(data_field):
|
|
|
10
10
|
|
|
11
11
|
class Response(object):
|
|
12
12
|
def __init__(self, request):
|
|
13
|
+
self.noabort = False
|
|
13
14
|
self.id = request.id
|
|
14
15
|
self.ip = request.real_ip
|
|
15
16
|
self.request = request
|
|
@@ -52,7 +53,7 @@ class Response(object):
|
|
|
52
53
|
|
|
53
54
|
def _close(self):
|
|
54
55
|
timeout(.001, self.response.dispatch)
|
|
55
|
-
abort_branch()
|
|
56
|
+
self.noabort or abort_branch()
|
|
56
57
|
|
|
57
58
|
def _header(self, *args, **kwargs):
|
|
58
59
|
self.response.__setitem__(*args, **kwargs)
|
babyweb/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: babyweb
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Basic Asynchronous weB librarY
|
|
5
5
|
Author: Mario Balibrera
|
|
6
6
|
Author-email: mario.balibrera@gmail.com
|
|
@@ -13,7 +13,7 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: dez >=0.10.10.
|
|
16
|
+
Requires-Dist: dez >=0.10.10.43
|
|
17
17
|
Requires-Dist: fyg >=0.1.7.8
|
|
18
18
|
Requires-Dist: requests >=2.28.1
|
|
19
19
|
|
|
@@ -6,20 +6,20 @@ babyweb/daemons.py,sha256=YbTVcyG7xlOm1LFtJcsFGIGsV1I-jjjn_byqMPSPnQI,1886
|
|
|
6
6
|
babyweb/logger.py,sha256=evX96jubM5UlF20-1v83Z0rqKnSPDjIYkiE75YUlD1c,1083
|
|
7
7
|
babyweb/mail.py,sha256=A7FL99zDU9Y_LAZPpw9-LWOsxuc1eoiGMN1EYVrwOIo,607
|
|
8
8
|
babyweb/memcache.py,sha256=W6JWcBjJPZx8RPYQXYRbCWMl-ziwy9OtzCvxV9RlCXs,484
|
|
9
|
-
babyweb/requesters.py,sha256=
|
|
10
|
-
babyweb/response.py,sha256=
|
|
9
|
+
babyweb/requesters.py,sha256=dpkw94d5UbRkEIBwShLQk98571VIP-SI9sSFww3MXtg,3523
|
|
10
|
+
babyweb/response.py,sha256=W5oZsTlUUSee3KeDQDG1QgSNiFx_z96HaNKDogNgtes,2373
|
|
11
11
|
babyweb/routes.py,sha256=V9EQKjWqbwWrR1t4Ren9IGAcmcS5awYCIHdseWoEqVU,483
|
|
12
12
|
babyweb/server.py,sha256=l1Co447w-Ef3Tlu0sj_cERRbvSS_GCbaTkHhfsJrJh8,1561
|
|
13
13
|
babyweb/shield.py,sha256=uB4vDKf6jKwWIebAjitm_q9T86iKPRKPNNeKcPgLfrE,1551
|
|
14
14
|
babyweb/sms.py,sha256=lYQFgpFjAas1XIolE0QC4ro2wgXH7hruzV1Dxz72-sE,299
|
|
15
|
-
babyweb/version.py,sha256=
|
|
15
|
+
babyweb/version.py,sha256=R5TtpJu7Qu6sOarfDpp-5Oyy8Pi2Ir3VewCvsCQiAgo,21
|
|
16
16
|
babyweb/util/__init__.py,sha256=LWPdEVAVSq9NE7SHH434tlb517B4DfUFIWAc25QECI8,357
|
|
17
17
|
babyweb/util/converters.py,sha256=SfGPkBFK1GBm085WdtUjskXK0Y_j8yRs7UC_aeLIOmg,1541
|
|
18
18
|
babyweb/util/loaders.py,sha256=wD9H9pB6HWAB41i7oTNfxaKd7BOV9p4oNHu4F5-ilkk,1597
|
|
19
19
|
babyweb/util/responders.py,sha256=w_STmdUvdB9seOxOV0v-WAFUrqVrlUtuqoLRG-QugLI,6195
|
|
20
20
|
babyweb/util/setters.py,sha256=xIHtdLQgdlyCUC83q3ZW8ab6U5Rj3UU6ZgK70b-TOg4,337
|
|
21
|
-
babyweb-0.1.
|
|
22
|
-
babyweb-0.1.
|
|
23
|
-
babyweb-0.1.
|
|
24
|
-
babyweb-0.1.
|
|
25
|
-
babyweb-0.1.
|
|
21
|
+
babyweb-0.1.3.dist-info/LICENSE,sha256=TCGFq2RZnPZed3cKBhfq8EIxNzHcwJWJsBW8p9y1dDk,1068
|
|
22
|
+
babyweb-0.1.3.dist-info/METADATA,sha256=kGEocqJBtxySjK1pK6kNKGrHQBg93ossJq-CqL_1FuQ,760
|
|
23
|
+
babyweb-0.1.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
24
|
+
babyweb-0.1.3.dist-info/top_level.txt,sha256=-KcZVMe9-tSS5gwyDZGyLvU5bemV6aWTSofb0B37Mts,8
|
|
25
|
+
babyweb-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|