Skip to content

Commit c2d7d67

Browse files
committed
Merge commit '280024'
2 parents 5477c13 + 2800245 commit c2d7d67

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

Diff for: absbox/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
raise ImportError("AbsBox support Python with version 3.10+ only")
55

66
from absbox.client import API, Endpoints, EnginePath, PickApiFrom
7-
from absbox.local.util import guess_pool_flow_header, unifyTs, mkTbl
7+
from absbox.local.util import guess_pool_flow_header, unifyTs, mkTbl, readAeson
88
from absbox.local.base import *
99
from absbox.local.cmp import comp_engines
1010
from absbox.local.china import 信贷ABS, SPV

Diff for: absbox/local/util.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ def readAeson(x:dict):
472472
return [readAeson(_x) for _x in x]
473473
case n if isinstance(n,float) or isinstance(n,int):
474474
return n
475+
case m if isinstance(m, dict):
476+
return {k: readAeson(v) for k,v in m.items() }
477+
case s if isinstance(s, str):
478+
return s
475479
case None:
476480
return None
477481
case {}:
@@ -483,4 +487,4 @@ def readAeson(x:dict):
483487

484488
def getNumCols(df:pd.DataFrame)-> list:
485489
numeric_columns = [col for col in df.columns if pd.to_numeric(df[col], errors='coerce').notna().all()]
486-
return numeric_columns
490+
return numeric_columns

Diff for: docs/source/howto.rst

+32-1
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,37 @@ CLO features:
11361136

11371137

11381138

1139+
How to get response ?
1140+
-------------------------------
1141+
1142+
Typically, a function call has parameter ``read``
1143+
1144+
1145+
read = True
1146+
^^^^^^^^^^^^^^^
1147+
1148+
If user supplied with ``True``, absbox will try to convert response with pandas dataframe where possible.
1149+
1150+
1151+
read = False
1152+
^^^^^^^^^^^^^^^
1153+
1154+
Or, use can pass with read with ``False``, which will just return a raw response from servant/aeson.
1155+
1156+
To make it slightly readable , there is a util function may help.
1157+
1158+
.. versionadded:: 0.42.6
1159+
1160+
.. code-block:: python
1161+
1162+
from absbox import readAeson
1163+
1164+
r0 = localAPI.run(.....,read=False)
1165+
1166+
readAeson(r0)
1167+
1168+
1169+
11391170
How to use pre-built executable
11401171
------------------------------------------------
11411172

@@ -1177,4 +1208,4 @@ Verify
11771208
11781209
.. image:: img/confirm_url.png
11791210
:width: 300
1180-
:alt: server_running
1211+
:alt: server_running

0 commit comments

Comments
 (0)