19 lines
845 B
Python
19 lines
845 B
Python
|
|
import os, requests, pathlib
|
||
|
|
for line in pathlib.Path(r'C:\Users\SJ\.minimax-agent\projects\Workflow\.env.local').read_text().splitlines():
|
||
|
|
if line.strip() and '=' in line and not line.startswith('#'):
|
||
|
|
k, v = line.split('=', 1)
|
||
|
|
os.environ.setdefault(k.strip(), v.strip())
|
||
|
|
token = os.environ['PB_TOKEN']
|
||
|
|
h = {'Authorization': f'Bearer {token}'}
|
||
|
|
r = requests.get(
|
||
|
|
'https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records',
|
||
|
|
headers=h, params={'perPage': 50}, timeout=15,
|
||
|
|
)
|
||
|
|
r.raise_for_status()
|
||
|
|
print(f'Total rows: {len(r.json()["items"])}')
|
||
|
|
print()
|
||
|
|
for it in r.json()['items']:
|
||
|
|
print(f' {it["company_period_key"]:40} Return_Filed={it.get("Return_Filed")} '
|
||
|
|
f'status={it.get("status"):10} paye={it.get("paye_amount"):>10} '
|
||
|
|
f'last_updated={it.get("last_updated")}')
|