swh.lister.gitlab: Improve headers extraction

This commit is contained in:
Antoine R. Dumont (@ardumont) 2018-07-11 18:02:28 +02:00
parent 847a8d341a
commit 13bb7aca58
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
4 changed files with 69 additions and 3 deletions

14
swh/lister/utils.py Normal file
View file

@ -0,0 +1,14 @@
# Copyright (C) 2018 the Software Heritage developers
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
def get(d, keys):
"""Given a dict, lookup in order for keys with values not None.
"""
for key in keys:
v = d.get(key)
if v is not None:
return v
return None