ha-requests 0.1.0__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.
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: ha-requests
3
+ Version: 0.1.0
4
+ Summary: ha-requests - requestslib for hackide
5
+ License: MIT
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # ha-requests
10
+ requestslib for hackide
11
+
12
+ ## Basic Usage
13
+
14
+ ```python
15
+ import ha_requests as requests
16
+
17
+ r = requests.get("https://example.com")
18
+
19
+ print(r.text)
20
+ ```
@@ -0,0 +1,12 @@
1
+ # ha-requests
2
+ requestslib for hackide
3
+
4
+ ## Basic Usage
5
+
6
+ ```python
7
+ import ha_requests as requests
8
+
9
+ r = requests.get("https://example.com")
10
+
11
+ print(r.text)
12
+ ```
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ha-requests"
7
+ version = "0.1.0"
8
+ description = "ha-requests - requestslib for hackide"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+
13
+ [tool.setuptools.packages.find]
14
+ where = ["src"]
15
+ include = ["ha_requests*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,48 @@
1
+ import json as jsn
2
+ from base64 import b64encode, b64decode
3
+ from urllib import request
4
+
5
+ class Response():
6
+ def __init__(self):
7
+ self.status_code = 0
8
+ self.headers = {}
9
+ self.encoding = ""
10
+ self.text = ""
11
+ self.url = ""
12
+ self.content = b''
13
+
14
+ def json(self):
15
+ return jsn.loads(self.text)
16
+
17
+ def _toResponseEnum(status, headers, encoding, content, url):
18
+ content = b64decode(content)
19
+ r = Response()
20
+ r.status = status
21
+ r.headers = headers
22
+ r.encoding = encoding
23
+ r.text = content.decode(encoding)
24
+ r.url = url
25
+ r.content = content
26
+ return r
27
+
28
+ def _sendTunneledRequest(url, method, data, headers):
29
+ payload = {
30
+ "u": url,
31
+ "m": method,
32
+ "b": jsn.dumps(data),
33
+ "h": jsn.dumps(headers)
34
+ }
35
+ tr = jsn.loads(request.urlopen("https://hidereqlibbackend.vercel.app/?q=" + b64encode(jsn.dumps(payload).encode("utf-8")).decode("utf-8")).read())
36
+ return _toResponseEnum(tr["s"], headers, tr["e"], tr["c"], url)
37
+
38
+ def get(url, body={}, headers={}):
39
+ return _sendTunneledRequest(url, "GET", body, headers)
40
+
41
+ def post(url, body={}, headers={}):
42
+ return _sendTunneledRequest(url, "POST", body, headers)
43
+
44
+ def put(url, body={}, headers={}):
45
+ return _sendTunneledRequest(url, "PUT", body, headers)
46
+
47
+ def delete(url, body={}, headers={}):
48
+ return _sendTunneledRequest(url, "DELETE", body, headers)
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: ha-requests
3
+ Version: 0.1.0
4
+ Summary: ha-requests - requestslib for hackide
5
+ License: MIT
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # ha-requests
10
+ requestslib for hackide
11
+
12
+ ## Basic Usage
13
+
14
+ ```python
15
+ import ha_requests as requests
16
+
17
+ r = requests.get("https://example.com")
18
+
19
+ print(r.text)
20
+ ```
@@ -0,0 +1,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/ha_requests/__init__.py
4
+ src/ha_requests.egg-info/PKG-INFO
5
+ src/ha_requests.egg-info/SOURCES.txt
6
+ src/ha_requests.egg-info/dependency_links.txt
7
+ src/ha_requests.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ ha_requests