jupyterlite-simple-cors-proxy 0.1.15__py3-none-any.whl → 0.1.16__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.
@@ -3,5 +3,5 @@ from .cacheproxy import cors_proxy_get, robust_get_request, xurl, furl
3
3
 
4
4
  # from .fastf1_proxy import enable_cors_proxy as fastf1_cors_proxy
5
5
 
6
- __version__ = "0.1.15"
6
+ __version__ = "0.1.16"
7
7
  __all__ = ["cors_proxy_get", "robust_get_request", "xurl", "furl"]
@@ -13,7 +13,6 @@ CORS_PROXIES = {
13
13
  "none": {"url": "{}", "quote": False},
14
14
  }
15
15
 
16
- cache_bust_headers = {"Cache-Control": "no-cache", "Pragma": "no-cache"}
17
16
 
18
17
  class CorsProxy:
19
18
  """CORS Proxy with optional caching support."""
@@ -91,7 +90,7 @@ class CorsProxy:
91
90
  # https://simonwillison.net/2025/Jan/31/save-memory-with-bytesio/
92
91
  return io.BytesIO(r.content)
93
92
 
94
- def cors_proxy_get(self, url: str, params: Optional[dict] = None, force: bool = False, proxy: str = "corsproxyio", cache_bust: bool=True) -> requests.Response:
93
+ def cors_proxy_get(self, url: str, params: Optional[dict] = None, force: bool = False, proxy: str = "corsproxyio") -> requests.Response:
95
94
  """
96
95
  CORS proxy for GET resources with requests-like response.
97
96
 
@@ -104,20 +103,18 @@ class CorsProxy:
104
103
  A requests response object.
105
104
  """
106
105
  proxy_url = self.xurl(url, params, force)
107
- headers = cache_bust_headers if cache_bust else None
108
- return self.session.get(proxy_url, headers=headers)
106
+ return self.session.get(proxy_url)
109
107
 
110
108
  def robust_get_request(
111
- self, url: str, params: Optional[dict] = None, proxy: str = "", cache_bust :bool = True
109
+ self, url: str, params: Optional[dict] = None, proxy: str = ""
112
110
  ) -> requests.Response:
113
111
  """
114
112
  Try to make a simple request else fall back to a proxy.
115
113
  """
116
- headers = cache_bust_headers if cache_bust else None
117
114
  try:
118
- r = self.session.get(url, params=params, headers=headers)
115
+ r = self.session.get(url, params=params)
119
116
  except:
120
- r = self.cors_proxy_get(url, params=params, proxy=proxy, headers=headers)
117
+ r = self.cors_proxy_get(url, params=params, proxy=proxy)
121
118
  return r
122
119
 
123
120
 
@@ -12,7 +12,6 @@ CORS_PROXIES = {
12
12
  "none": {"url": "{}", "quote": False},
13
13
  }
14
14
 
15
- cache_bust_headers = {"Cache-Control": "no-cache","Pragma": "no-cache"}
16
15
 
17
16
  def apply_cors_proxy(url, proxy="corsproxyio"):
18
17
  """
@@ -51,9 +50,9 @@ def xurl(url, params=None, force=False, proxy="corsproxyio"):
51
50
  return url
52
51
 
53
52
 
54
- def furl(url, params=None, force=False, proxy="corsproxyio", cache_bust=True):
53
+ def furl(url, params=None, force=False, proxy="corsproxyio"):
55
54
  """Return file like object after calling the proxied URL."""
56
- r = cors_proxy_get(url, params, force, proxy=proxy, cache_bust=cache_bust)
55
+ r = cors_proxy_get(url, params, force, proxy=proxy)
57
56
 
58
57
  # Return a file-like object from the JSON string
59
58
  # TO DO - something to consider?
@@ -61,7 +60,7 @@ def furl(url, params=None, force=False, proxy="corsproxyio", cache_bust=True):
61
60
  return io.BytesIO(r.content)
62
61
 
63
62
 
64
- def cors_proxy_get(url, params=None, force=False, proxy="corsproxyio", cache_bust=True):
63
+ def cors_proxy_get(url, params=None, force=False, proxy="corsproxyio"):
65
64
  """
66
65
  CORS proxy for GET resources with requests-like response.
67
66
 
@@ -76,17 +75,15 @@ def cors_proxy_get(url, params=None, force=False, proxy="corsproxyio", cache_bus
76
75
 
77
76
  # Do a simple requests get and
78
77
  # just pass through the entire response object
79
- headers = cache_bust_headers if cache_bust else None
80
- return requests.get(proxy_url, headers=headers)
78
+ return requests.get(proxy_url)
81
79
 
82
80
 
83
- def robust_get_request(url, params=None, proxy="corsproxyio", cache_bust=True):
81
+ def robust_get_request(url, params=None, proxy="corsproxyio"):
84
82
  """
85
83
  Try to make a simple request else fall back to a proxy.
86
84
  """
87
- headers = cache_bust_headers if cache_bust else None
88
85
  try:
89
- r = requests.get(url, params=params, headers=headers)
86
+ r = requests.get(url, params=params)
90
87
  except:
91
- r = cors_proxy_get(url, params=params, proxy=proxy, cache_bust=cache_bust)
88
+ r = cors_proxy_get(url, params=params, proxy=proxy)
92
89
  return r
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jupyterlite-simple-cors-proxy
3
- Version: 0.1.15
3
+ Version: 0.1.16
4
4
  Summary: A simple CORS proxy utility with requests-like response
5
5
  Home-page: https://github.com/innovationOUtside/jupyterlite-simple-cors-proxy
6
6
  Author: Tony Hirst
@@ -0,0 +1,9 @@
1
+ jupyterlite_simple_cors_proxy/__init__.py,sha256=4gT0U9OcwOsvtooyzJHIM3dvAC-vvYpXtUUWw8ZUx8o,280
2
+ jupyterlite_simple_cors_proxy/cacheproxy.py,sha256=svCmdb6j06PcU2zmG0ppe6S1-f0GPwGmkxIemwkeYJc,4464
3
+ jupyterlite_simple_cors_proxy/fastf1_proxy.py,sha256=FglRogTIlSJvHOu6lFS3S-EHDb37M93aYjQpoKc1QYs,7614
4
+ jupyterlite_simple_cors_proxy/proxy.py,sha256=jJgoawJxXFCSazwkV3jb6R1uMc7lrkpHgOCrcwAY06w,2477
5
+ jupyterlite_simple_cors_proxy-0.1.16.dist-info/licenses/LICENSE,sha256=Ogw7GUmeZIxmDNiKWsu_N07svNoGnPB7lWyiXHX_rMY,1074
6
+ jupyterlite_simple_cors_proxy-0.1.16.dist-info/METADATA,sha256=WscKoL0OBw7F-qK9LRi0dQHQwXCkZ3vCnfRhuSMsuYI,3166
7
+ jupyterlite_simple_cors_proxy-0.1.16.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
8
+ jupyterlite_simple_cors_proxy-0.1.16.dist-info/top_level.txt,sha256=Oh0oQrSmRnBq5u675coiKMbkb2ASg8AGF8ZiZTzUS5Q,30
9
+ jupyterlite_simple_cors_proxy-0.1.16.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- jupyterlite_simple_cors_proxy/__init__.py,sha256=b0mRQUorFy9-0CFElhhyI0UMVKf_tYuToyiXDlXyaSw,280
2
- jupyterlite_simple_cors_proxy/cacheproxy.py,sha256=_Dx-eI4ZDqdCgJuRPsahFqqUW3DVNx9keo9C11U905A,4758
3
- jupyterlite_simple_cors_proxy/fastf1_proxy.py,sha256=FglRogTIlSJvHOu6lFS3S-EHDb37M93aYjQpoKc1QYs,7614
4
- jupyterlite_simple_cors_proxy/proxy.py,sha256=pDvN_ZUmVfN6yjYcAzo5k16uJQ6wv-fJsl1ycBXywwQ,2795
5
- jupyterlite_simple_cors_proxy-0.1.15.dist-info/licenses/LICENSE,sha256=Ogw7GUmeZIxmDNiKWsu_N07svNoGnPB7lWyiXHX_rMY,1074
6
- jupyterlite_simple_cors_proxy-0.1.15.dist-info/METADATA,sha256=MswZgGHD5q5YG-EUApBXsyl1TsS2dUaZ9mRju92vm-8,3166
7
- jupyterlite_simple_cors_proxy-0.1.15.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
8
- jupyterlite_simple_cors_proxy-0.1.15.dist-info/top_level.txt,sha256=Oh0oQrSmRnBq5u675coiKMbkb2ASg8AGF8ZiZTzUS5Q,30
9
- jupyterlite_simple_cors_proxy-0.1.15.dist-info/RECORD,,