my.stackexchange: use proper pip package, add stat

+ 'anonymous' mode for stat() function
This commit is contained in:
Dima Gerasimov 2020-12-04 16:49:42 +00:00 committed by karlicoss
parent 9d39892e75
commit ddea816a49
6 changed files with 50 additions and 20 deletions

View file

@ -0,0 +1,28 @@
'''
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)