I haven’t used either of those libraries, but perhaps you should be calling get_releases_by_discid instead of get_release_by_id (which I suspect expects an MBID, not a disc ID). I think the object you’re passing to it may not be right, either (per the discid docs). I’d guess it should be something like:
result = musicbrainzngs.get_releases_by_discid(d.id, includes=['labels'])
Per the musicbrainzngs docs, you might then need to update the next line to something like result['disc']['release-list'][0]['catalog-number'], or maybe result['release-list'][0]['catalog-number']:
The result is a dict with either a ‘disc’ , a ‘cdstub’ key or a ‘release-list’ (fuzzy match with TOC). A ‘disc’ has an ‘offset-count’, an ‘offset-list’ and a ‘release-list’. A ‘cdstub’ key has direct ‘artist’ and ‘title’ keys.