Package: goifer
goifergoiferis the glue code needed to extract information from the Gever (Geschäftsverwaltungssystem) of the canton of Zurich.
It is a client for python to make requests to theGever API.goiferis Swiss German for spit/saliva, a pun on «Gever» and the «spit» needed to get something out of it.Table of ContentsInstallationUsageDevelopmentReleaseInstallationgoifer is available on PyPI, so to install it simply use:$ pip install goiferUsageSee theexamplesdirectoryfor more scripts.searchsearchis used to query an index (i.e. entity) and get results.>>>importgoifer>>>result=goifer.search("canton_zurich",index="Wahlkreise",query="seq > 0")>>>print(result)SearchResponse(count=18,next_start_record=11)>>>print(result.count)18>>>print(result[0]){'obj_guid':'99221ca914ae43ab99935379dd4be037','seq':'2242327','idx':'Wahlkreise','name':'XIII Pfäffikon','nil':False,'inaktiv':False}The return value ofsearchis iterable, so you can easily loop over it.
Or you can use indices to access elements, e.g.result[1]to get the second element, orresult[-1]to get the last one.Evenslicingis supported, so you can do things like only iterate over the first 5 elements usingforrecordsinrecords[:5]:print(record)indexesTo get a better idea of the available indexes, you can get all configured indexes withindexes:>>> goifer.indexes('canton_zurich')
['Behoerden', 'SitzungenDetail', 'Geschaeft', 'Mitglieder', 'Parteien', 'Wahlkreise', 'Direktion', 'Geschaeftsart', 'Gremiumtyp', 'KRVersand', 'Ablaufschritt']fileSome indexes return a reference to a document (callededokumentoredocument).goifergenerates a download URL for those documents:>>> meetings = goifer.search("canton_zurich", "SitzungenDetail", "seq>0")
>>> meetings[0]['dokument']['edokument']
{'id': '9db1203429e04a39a233e56eab42feea-332', 'filename': '63. KR-Protokoll vom 9.7.2012, Nachmittag.pdf', 'version': {'nr': '1', 'rendition': {'extension': 'pdf', 'ansicht': 'PDF'}}, 'download_url': 'https://parlzhcdws.cmicloud.ch/parlzh3/cdws/Files/9db1203429e04a39a233e56eab42feea-332/1/PDF'}Thedownload_urlcan be used to download the file, the corresponding filename is in thefilenamefield.Sometimes you want to generate the download URL yourself, in these cases you can use thefilemethod:>>> import goifer
>>> client = goifer.client("canton_zurich")
>>> res = client.search("Mitglieder", "Name adj Marti and Vorname adj Res")[0]
>>> client.file("Mitglieder", res["foto_id"], res['foto_version']['nr'], 'Original')
'https://parlzhcdws.cmicloud.ch/parlzh2/cdws/Files/6bf54e3bdd24400d85e13169c3a5bbf8-1664/1/Original'schemaTo know what fields are in a search result or to check with fields are available for queries (i.e.searchfields), use theschemamethod:>>> s = goifer.schema('canton_zurich', 'Wahlkreise')
{'targetnamespace': 'http://www.cmiag.ch/cdws/Wahlkreise', 'elementformdefault': 'qualified', 'annotation': {'documentation': {'searchfield': [{'type': 'SearchFieldBoolean', 'Name': 'inaktiv', 'BoostFactor': '1', 'Nrs': '6'}, {'type': 'SearchFieldText', 'Name': 'Name', 'BoostFactor': '1', 'Nrs': '5'}]}}, 'complextype': {'name': 'Wahlkreis', 'sequence': {'element': [{'name': 'Name', 'type': 'xsd:string'}, {'name': 'inaktiv', 'type': 'xsd:boolean', 'nillable': 'true'}]}, 'attribute': [{'name': 'OBJ_GUID', 'type': 'xsd:string', 'use': 'required'}, {'name': 'SEQ', 'type': 'xsd:string', 'use': 'optional'}, {'name': 'IDX', 'type': 'xsd:string', 'use': 'optional'}]}, 'element': {'name': 'Wahlkreis', 'type': 'Wahlkreis'}}DevelopmentTo develop on this project, installflit:pip install flit
flit install -sOr use the provideddev_setup.shscript.To contribute to goifer simply clone this repository and follow the instructions inCONTRIBUTING.md.This project has a Makefile with the most common commands.
Typemake helpto get an overview.ReleaseTo create a new release, follow these steps (please respectSemantic Versioning):Adapt the version number ingoifer/__init__.pyUpdate the CHANGELOG with the versionCreate a pull request to mergedevelopintomain(make sure the tests pass!)Create anew release/tag on GitHub(on the main branch)Thepublication on PyPIhappens viaGitHub Actionson every tagged commit