parser.add_argument('session_id', help='The current PHPSESSID') parser.add_argument('--server', default='s1.railnation.de', help='The server where the session is active') parser.add_argument('--max_invest_count', default=2, type=int, help='Maximum of invest clicks per factory') parser.add_argument('--max_invest_costs', default=10000, type=int, help='Maximum costs for an individual invest') args = parser.parse_args() # let's go api = ServerCaller(args.server, args.session_id) tracks_graph = track_network(api) # factory properties factory_properties = api.properties('factories') factory_growth_properties = api.properties('factory_growth') factories = api.call('LocationInterface', 'getAllFactories', short_call=1236)['Body'] factories = [ factory for factory in factories if factory['Id'] in tracks_graph.nodes ] print(f'Connected to {len(factories)} factories') # iterate over all connected factories