To build on Pedro's discovery of support for unnamed sections in Python 3.13, an example:
import configparser
config = "config.ini"
cparser = configparser.ConfigParser(allow_unnamed_section=True)
cparser.read(config)
value = cparser.get(configparser.UNNAMED_SECTION, 'key1')
and while OP has no need to write/modify the original file, for those who do:
cparser.set(configparser.UNNAMED_SECTION, 'key1', 'new_val')
with open(config, 'w') as cf:
cparser.write(cf)