bird-update.py 343 B

12345678910111213141516171819
  1. #!/usr/bin/env python
  2. import sys
  3. import time
  4. import bird
  5. from utils import read_json, write_json
  6. DBFILE = '/srv/http/dn42/tower-bird.json'
  7. def update(dbfile, stream):
  8. new = bird.parse_bird(stream)
  9. db = read_json(dbfile)
  10. bird.update(db, new)
  11. write_json(db, dbfile)
  12. if __name__ == '__main__':
  13. update(DBFILE, sys.stdin)