Skip to content

Commit

Permalink
add case 25/remove read/load in china spv
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Jul 19, 2023
1 parent c9c28ea commit 50f7759
Show file tree
Hide file tree
Showing 6 changed files with 37,206 additions and 28 deletions.
26 changes: 0 additions & 26 deletions absbox/local/china.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@ class SPV:
自定义: dict = None
科目: dict = None

@classmethod
def load(cls,p):
with open(p,'rb') as _f:
c = _f.read()
return pickle.loads(c)

@classmethod
def pull(cls,_id,p,url=None,pw=None):
def get_filename_from_cd(cd):
if not cd:
return None
fname = re.findall("filename\*=utf-8''(.+)", cd)
if len(fname) == 0:
fname1 = re.findall("filename=\"(.+)\"", cd)
return fname1[0]
return unquote(fname[0])
with requests.get(f"{url}/china/deal/{_id}",stream=True,verify=False) as r:
filename = get_filename_from_cd(r.headers.get('content-disposition'))
if filename is None:
logging.error("Can't not find the Deal Name")
return None
with open(os.path.join(p,filename),'wb') as f:
shutil.copyfileobj(r.raw, f)
logging.info(f"Download {p} {filename} done ")


@property
def json(self):
stated = False
Expand Down
3 changes: 1 addition & 2 deletions absbox/local/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def mkBookLedgerType(x):
match x:
case ["PDL",defaults,ledgers]:
return mkTag(("PDL",[mkDs(defaults)
,[ (ln,mkDs(ds)) for ln,ds in ledgers]]))
,[(ln,mkDs(ds)) for ln,ds in ledgers]]))
case _:
raise RuntimeError(f"Failed to match :{x}:mkBookLedgerType")

Expand Down Expand Up @@ -1047,7 +1047,6 @@ def mkLedger(n, x):
return {"ledgName":n,"ledgBalance":bal,"ledgStmt":tx}
case _:
raise RuntimeError(f"Failed to match Ledger:{x}")


def mkCf(x):
if len(x) == 0:
Expand Down
Loading

0 comments on commit 50f7759

Please sign in to comment.