|
@@ -27,13 +27,12 @@ def main() -> None:
|
|
|
print(f'no stats')
|
|
print(f'no stats')
|
|
|
|
|
|
|
|
def iter_grants() -> typing.Iterator[str | None]:
|
|
def iter_grants() -> typing.Iterator[str | None]:
|
|
|
- (username,) = sys.argv[1:]
|
|
|
|
|
- params = {'username': username, 'status': 'TERMINATED', 'limit': 200, 'page': 1}
|
|
|
|
|
|
|
+ params = {'status': 'TERMINATED', 'page': 1}
|
|
|
while True:
|
|
while True:
|
|
|
- (data,) = httpx.get(f'https://api.punoted.net/v1/contracts/?username={username}&limit=200', params=params,
|
|
|
|
|
|
|
+ contracts = httpx.get(f'https://api.punoted.net/v1/contracts/user', params=params,
|
|
|
headers={'X-Data-Token': config.punoted_api_key}).raise_for_status().json()
|
|
headers={'X-Data-Token': config.punoted_api_key}).raise_for_status().json()
|
|
|
- data['Contracts'].sort(key=lambda c: c['DateEpochMs'])
|
|
|
|
|
- for contract in data['Contracts']:
|
|
|
|
|
|
|
+ contracts.sort(key=lambda c: c['DateEpochMs'])
|
|
|
|
|
+ for contract in contracts:
|
|
|
conditions = contract['Conditions']
|
|
conditions = contract['Conditions']
|
|
|
if len(conditions) != 2:
|
|
if len(conditions) != 2:
|
|
|
continue
|
|
continue
|
|
@@ -50,7 +49,7 @@ def iter_grants() -> typing.Iterator[str | None]:
|
|
|
print(f'{payment["Amount"]:9,} {payment["Currency"]}', contract['Timestamp'],
|
|
print(f'{payment["Amount"]:9,} {payment["Currency"]}', contract['Timestamp'],
|
|
|
contract['PartnerCode'], contract['PartnerName'], sep='\t', end='\t')
|
|
contract['PartnerCode'], contract['PartnerName'], sep='\t', end='\t')
|
|
|
yield contract['PartnerCode']
|
|
yield contract['PartnerCode']
|
|
|
- if len(data['Contracts']) < 200:
|
|
|
|
|
|
|
+ if len(contracts) == 0:
|
|
|
break
|
|
break
|
|
|
params['page'] += 1
|
|
params['page'] += 1
|
|
|
|
|
|