jupyterlite-simple-cors-proxy 0.0.1__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 innovationOUtside
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.1
2
+ Name: jupyterlite-simple-cors-proxy
3
+ Version: 0.0.1
4
+ Summary: A simple CORS proxy utility with requests-like response
5
+ Home-page: https://github.com/innovationOUtside/jupyterlite-simple-cors-proxy
6
+ Author: Tony Hirst
7
+ Author-email: tony.hirst@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests>=2.32.0
15
+
16
+ # jupyterlite-simple-cors-proxy
17
+ Simple CORS proxy for making http requests from JupyterLite
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install simple-cors-proxy
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ from simple_cors_proxy import cors_proxy
29
+
30
+ # Make a request
31
+ url = "https://api.example.com/data"
32
+ params = {"key": "value"}
33
+ response = cors_proxy(url, params)
34
+
35
+ # Use like requests
36
+ print(response.text)
37
+ data = response.json()
38
+ raw = response.content
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - Simple CORS proxy wrapper
44
+ - Requests-like response object
45
+ - Support for URL parameters
46
+ - JSON parsing
@@ -0,0 +1,31 @@
1
+ # jupyterlite-simple-cors-proxy
2
+ Simple CORS proxy for making http requests from JupyterLite
3
+
4
+ ## Installation
5
+
6
+ ```bash
7
+ pip install simple-cors-proxy
8
+ ```
9
+
10
+ ## Usage
11
+
12
+ ```python
13
+ from simple_cors_proxy import cors_proxy
14
+
15
+ # Make a request
16
+ url = "https://api.example.com/data"
17
+ params = {"key": "value"}
18
+ response = cors_proxy(url, params)
19
+
20
+ # Use like requests
21
+ print(response.text)
22
+ data = response.json()
23
+ raw = response.content
24
+ ```
25
+
26
+ ## Features
27
+
28
+ - Simple CORS proxy wrapper
29
+ - Requests-like response object
30
+ - Support for URL parameters
31
+ - JSON parsing
@@ -0,0 +1,5 @@
1
+ # File: jupyterlite_simple_cors_proxy/__init__.py
2
+ from .proxy import cors_proxy, ProxyResponse
3
+
4
+ __version__ = "0.1.0"
5
+ __all__ = ["cors_proxy", "ProxyResponse"]
@@ -0,0 +1,41 @@
1
+ # File: simple_cors_proxy/proxy.py
2
+ from urllib.parse import urlencode, quote
3
+ import requests
4
+
5
+ class ProxyResponse:
6
+ def __init__(self, content):
7
+ self._content = content
8
+
9
+ @property
10
+ def text(self):
11
+ return self._content
12
+
13
+ def json(self):
14
+ import json
15
+
16
+ return json.loads(self._content)
17
+
18
+ @property
19
+ def content(self):
20
+ return self._content.encode()
21
+
22
+
23
+ def cors_proxy(url, params=None):
24
+ """
25
+ CORS proxy for GET resources with requests-like response.
26
+
27
+ Args:
28
+ url (str): The URL to fetch
29
+ params (dict, optional): Query parameters to include
30
+
31
+ Returns:
32
+ ProxyResponse: A response object with .text, .json(), and .content methods
33
+ """
34
+ if params:
35
+ full_url = f"{url}?{urlencode(params)}"
36
+ else:
37
+ full_url = url
38
+
39
+ proxy_url = f"https://corsproxy.io/?{quote(full_url)}"
40
+ response = requests.get(proxy_url).content.decode().strip()
41
+ return ProxyResponse(response)
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.1
2
+ Name: jupyterlite-simple-cors-proxy
3
+ Version: 0.0.1
4
+ Summary: A simple CORS proxy utility with requests-like response
5
+ Home-page: https://github.com/innovationOUtside/jupyterlite-simple-cors-proxy
6
+ Author: Tony Hirst
7
+ Author-email: tony.hirst@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests>=2.32.0
15
+
16
+ # jupyterlite-simple-cors-proxy
17
+ Simple CORS proxy for making http requests from JupyterLite
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install simple-cors-proxy
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ from simple_cors_proxy import cors_proxy
29
+
30
+ # Make a request
31
+ url = "https://api.example.com/data"
32
+ params = {"key": "value"}
33
+ response = cors_proxy(url, params)
34
+
35
+ # Use like requests
36
+ print(response.text)
37
+ data = response.json()
38
+ raw = response.content
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - Simple CORS proxy wrapper
44
+ - Requests-like response object
45
+ - Support for URL parameters
46
+ - JSON parsing
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ jupyterlite_simple_cors_proxy/__init__.py
5
+ jupyterlite_simple_cors_proxy/proxy.py
6
+ jupyterlite_simple_cors_proxy.egg-info/PKG-INFO
7
+ jupyterlite_simple_cors_proxy.egg-info/SOURCES.txt
8
+ jupyterlite_simple_cors_proxy.egg-info/dependency_links.txt
9
+ jupyterlite_simple_cors_proxy.egg-info/requires.txt
10
+ jupyterlite_simple_cors_proxy.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ # File: setup.py
2
+ from setuptools import setup, find_packages
3
+
4
+ setup(
5
+ name="jupyterlite-simple-cors-proxy",
6
+ version="0.0.1",
7
+ packages=find_packages(),
8
+ install_requires=[
9
+ "requests>=2.32.0",
10
+ ],
11
+ author="Tony Hirst",
12
+ author_email="tony.hirst@gmail.com",
13
+ description="A simple CORS proxy utility with requests-like response",
14
+ long_description=open("README.md").read(),
15
+ long_description_content_type="text/markdown",
16
+ url="https://github.com/innovationOUtside/jupyterlite-simple-cors-proxy",
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ],
22
+ python_requires=">=3.6",
23
+ )