feat(tools): whop_pdfs.py liest USD-Betrag und pay-ID aus Whop-Belegen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bd2c1eed9a
commit
d60627c135
1 changed files with 7 additions and 0 deletions
7
tools/whop_pdfs.py
Normal file
7
tools/whop_pdfs.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"""Whop-Belege (outbound, via_api/sent/manual) -> Datum, $-Betrag, pay_-ID aus PDF. Im Backend-Container: python /tmp/whop_pdfs.py"""
|
||||
import glob, re, fitz
|
||||
for f in sorted(glob.glob('/data/rechnungen/picker/*/*/*whop*.pdf')):
|
||||
t=' '.join(' '.join(p.get_text() for p in fitz.open(f)).split())
|
||||
a=re.findall(r'\$\s?([\d,]+\.\d{2})',t); pid=re.search(r'pay_\w+',t)
|
||||
d=re.search(r'([A-Z][a-z]{2,8} \d{1,2}, 20\d\d)',t)
|
||||
print(f.split('/')[-1],'|',d.group(1) if d else '?','|',a[-1] if a else '?','|',pid.group(0) if pid else '?')
|
||||
Loading…
Add table
Reference in a new issue