importargparsefromoffice365.sharepoint.client_contextimportClientContextfromtests.settingsimportclient_id,password,site_url,tenant,usernamedefmain():parser=argparse.ArgumentParser(description="List all hub sites the current user can access")parser.add_argument("--site-url",default=site_url,help="target site URL")args=parser.parse_args()ctx=ClientContext(args.site_url).with_username_and_password(tenant=tenant,client_id=client_id,username=username,password=password)hub_sites=ctx.hub_sites.get().execute_query()forhubinhub_sites:print(f"{hub.title} ({hub.site_url})")if__name__=="__main__":main()