yjdata 0.2.0__tar.gz → 0.2.1__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.
- {yjdata-0.2.0 → yjdata-0.2.1}/PKG-INFO +1 -1
- {yjdata-0.2.0 → yjdata-0.2.1}/pyproject.toml +1 -1
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/_context.py +20 -12
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata.egg-info/PKG-INFO +1 -1
- {yjdata-0.2.0 → yjdata-0.2.1}/README.md +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/setup.cfg +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/__init__.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/_optional.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dataset/__init__.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dataset/common.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dataset/quote.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dataset/snapshot.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dataset/trade.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/__init__.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/adapter.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/expression.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/mysql.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/postgres.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/db/sql.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/dtype.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/utlity/__init__.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/utlity/s3.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/__init__.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/_input.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/calendar.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/client.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata/web/time_util.py +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata.egg-info/SOURCES.txt +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata.egg-info/dependency_links.txt +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata.egg-info/requires.txt +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/src/yjdata.egg-info/top_level.txt +0 -0
- {yjdata-0.2.0 → yjdata-0.2.1}/tests/test_last_of_group.py +0 -0
|
@@ -40,35 +40,43 @@ class RequestContext(abc.ABC):
|
|
|
40
40
|
def post_model_list(self, model: Type[T], url: str, payload: dict, **kwargs):
|
|
41
41
|
pass
|
|
42
42
|
|
|
43
|
+
@staticmethod
|
|
44
|
+
def _proc_args(kwargs: dict):
|
|
45
|
+
return {
|
|
46
|
+
**kwargs,
|
|
47
|
+
'follow_redirects': True,
|
|
48
|
+
'verify': False
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
|
|
44
52
|
class SyncRequestContext(RequestContext):
|
|
45
53
|
def __init__(self):
|
|
46
54
|
self._client = httpx.Client()
|
|
47
55
|
|
|
48
56
|
def get(self, url: str, **kwargs):
|
|
49
|
-
res = self._client.get(url, **kwargs)
|
|
57
|
+
res = self._client.get(url, **self._proc_args(kwargs))
|
|
50
58
|
res.raise_for_status()
|
|
51
59
|
return res.json()
|
|
52
60
|
|
|
53
61
|
def get_model(self, model: Type[T], url: str, **kwargs) -> List[T]:
|
|
54
|
-
res = self.get(url, **kwargs)
|
|
62
|
+
res = self.get(url, **self._proc_args(kwargs))
|
|
55
63
|
return model.model_validate(res)
|
|
56
64
|
|
|
57
65
|
def get_model_list(self, model: Type[T], url: str, **kwargs) -> List[T]:
|
|
58
|
-
res = self.get(url, **kwargs)
|
|
66
|
+
res = self.get(url, **self._proc_args(kwargs))
|
|
59
67
|
return [model.model_validate(x) for x in res]
|
|
60
68
|
|
|
61
69
|
def post(self, url: str, payload: dict, **kwargs):
|
|
62
|
-
res = self._client.post(url, json=payload, **kwargs)
|
|
70
|
+
res = self._client.post(url, json=payload, **self._proc_args(kwargs))
|
|
63
71
|
res.raise_for_status()
|
|
64
72
|
return res.json()
|
|
65
73
|
|
|
66
74
|
def post_model(self, model: Type[T], url: str, payload: dict, **kwargs) -> T:
|
|
67
|
-
res = self.post(url, payload, **kwargs)
|
|
75
|
+
res = self.post(url, payload, **self._proc_args(kwargs))
|
|
68
76
|
return model.model_validate(res)
|
|
69
77
|
|
|
70
78
|
def post_model_list(self, model: Type[T], url: str, payload: dict, **kwargs) -> List[T]:
|
|
71
|
-
res = self.post(url, payload, **kwargs)
|
|
79
|
+
res = self.post(url, payload, **self._proc_args(kwargs))
|
|
72
80
|
return [model.model_validate(x) for x in res]
|
|
73
81
|
|
|
74
82
|
|
|
@@ -77,27 +85,27 @@ class AsyncRequestContext(RequestContext):
|
|
|
77
85
|
self._client = httpx.AsyncClient()
|
|
78
86
|
|
|
79
87
|
async def get(self, url: str, **kwargs):
|
|
80
|
-
res = await self._client.get(url, **kwargs)
|
|
88
|
+
res = await self._client.get(url, **self._proc_args(kwargs))
|
|
81
89
|
res.raise_for_status()
|
|
82
90
|
return res.json()
|
|
83
91
|
|
|
84
92
|
async def get_model(self, model: Type[T], url: str, **kwargs) -> T:
|
|
85
|
-
res = await self.get(url, **kwargs)
|
|
93
|
+
res = await self.get(url, **self._proc_args(kwargs))
|
|
86
94
|
return model.model_validate(res)
|
|
87
95
|
|
|
88
96
|
async def get_model_list(self, model: Type[T], url: str, **kwargs) -> List[T]:
|
|
89
|
-
res = await self.get(url, **kwargs)
|
|
97
|
+
res = await self.get(url, **self._proc_args(kwargs))
|
|
90
98
|
return [model.model_validate(x) for x in res]
|
|
91
99
|
|
|
92
100
|
async def post(self, url: str, payload: dict, **kwargs):
|
|
93
|
-
res = await self._client.post(url, json=payload, **kwargs)
|
|
101
|
+
res = await self._client.post(url, json=payload, **self._proc_args(kwargs))
|
|
94
102
|
res.raise_for_status()
|
|
95
103
|
return res.json()
|
|
96
104
|
|
|
97
105
|
async def post_model(self, model: Type[T], url: str, payload: dict, **kwargs) -> T:
|
|
98
|
-
res = await self.post(url, payload, **kwargs)
|
|
106
|
+
res = await self.post(url, payload, **self._proc_args(kwargs))
|
|
99
107
|
return model.model_validate(res)
|
|
100
108
|
|
|
101
109
|
async def post_model_list(self, model: Type[T], url: str, payload: dict, **kwargs) -> List[T]:
|
|
102
|
-
res = await self.post(url, payload, **kwargs)
|
|
110
|
+
res = await self.post(url, payload, **self._proc_args(kwargs))
|
|
103
111
|
return [model.model_validate(x) for x in res]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|