project-stats

keep track of your projects
git clone https://git.ce9e.org/project-stats.git

commit
6fe14b9d21e2b3d4d87aa1530da681a53c467ce2
parent
cc9bdcc243d87f43028c1ef16c72baf672637cbd
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2015-03-22 14:46
make github credentials optional

Diffstat

M projects.py 12 ++++++++++--

1 files changed, 10 insertions, 2 deletions


diff --git a/projects.py b/projects.py

@@ -43,6 +43,14 @@ KEYS = [
   43    43 ]
   44    44 
   45    45 
   -1    46 def r_get(d, *keys):
   -1    47     """Recursively get key from dict or return None."""
   -1    48     if len(keys) == 0:
   -1    49         return d
   -1    50     elif keys[0] in d:
   -1    51         return r_get(d[keys[0]], *keys[1:])
   -1    52 
   -1    53 
   46    54 class Claims(object):
   47    55     def __init__(self):
   48    56         self._list = []
@@ -341,8 +349,8 @@ def main():
  341   349                         if source == 'github':
  342   350                             data = fn(
  343   351                                 project[source],
  344    -1                                 user=config['github']['user'],
  345    -1                                 password=config['github']['password'])
   -1   352                                 user=r_get(config, 'github', 'user'),
   -1   353                                 password=r_get(config, 'github', 'password'))
  346   354                         else:
  347   355                             data = fn(project[source])
  348   356                         claims.update(data, source)