populate.py 537 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python3
  2. import datetime
  3. import json
  4. import os
  5. import lc.config as c
  6. import lc.model as m
  7. import lc.request as r
  8. def main():
  9. m.create_tables()
  10. u = m.User.get_or_none(name="gdritter")
  11. if not u:
  12. u = m.User.from_request(
  13. r.User(name="gdritter", password=os.getenv("PASSWORD", "behest").strip(),)
  14. )
  15. u.set_as_admin()
  16. c.log(f"created user {u.name}")
  17. with open("scripts/aisamanra.json") as f:
  18. u.import_pinboard_data(f)
  19. if __name__ == "__main__":
  20. main()