HPI/my/stackexchange/stexport.py
Dima Gerasimov ddea816a49 my.stackexchange: use proper pip package, add stat
+ 'anonymous' mode for stat() function
2020-12-11 07:02:16 +01:00

28 lines
512 B
Python

'''
Stackexchange data
'''
REQUIRES = [
'git+https://github.com/karlicoss/stexport',
]
# TODO use GDPR?
from stexport import dal
from my.config import stackexchange as config
# todo lru cache?
def _dal() -> dal.DAL:
from ..core import get_files
inputs = get_files(config.export_path)
return dal.DAL(inputs)
def site(name: str) -> dal.SiteDAL:
return _dal().site_dal(name)
from ..core import stat, Stats
def stats() -> Stats:
s = site('stackoverflow')
return stat(s.questions)