2 Commits 7d28c40b7a ... 5370fe8958

Auteur SHA1 Message Date
  raylu 5370fe8958 grants: skip companies that can't be found il y a 2 semaines
  raylu d4c0f31812 market: only show HRT warehouse il y a 2 semaines
2 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 3 0
      market.py
  2. 5 1
      punoted/grants.py

+ 3 - 0
market.py

@@ -63,6 +63,8 @@ def check_warehouses() -> None:
 			headers={'Authorization': config.fio_rest_key})
 	now = datetime.datetime.now(datetime.UTC)
 	for warehouse in warehouses:
+		if warehouse['LocationNaturalId'] != 'HRT':
+			continue
 		storage: Storage = cache.get(f'https://rest.fnar.net/storage/{config.username}/{warehouse["StoreId"]}',
 			headers={'Authorization': config.fio_rest_key})
 		for item in storage['StorageItems']:
@@ -78,6 +80,7 @@ def check_warehouses() -> None:
 					if now - dt > datetime.timedelta(days=7):
 						break
 					print(f'  {dt} {trade["PartnerName"]} {trade["Amount"]} @ {trade["Price"]}')
+		break
 
 def analyze_markets(raw_prices: typing.Sequence[RawPrice]) -> typing.Iterator[MarketHealth]:
 	'''score IC1 based on how much better the other CXes are'''

+ 5 - 1
punoted/grants.py

@@ -16,7 +16,11 @@ def main() -> None:
 		if co is None:
 			print('\n')
 			continue
-		company = cache.get('https://rest.fnar.net/company/code/' + co)
+		try:
+			company = cache.get('https://rest.fnar.net/company/code/' + co)
+		except cache.NoContent:
+			print('no FIO REST data for', co)
+			continue
 		co_id = company['CompanyId']
 		username = company['UserName']
 		print(username, end='\t')