my.stackexchange: use proper pip package, add stat
+ 'anonymous' mode for stat() function
This commit is contained in:
parent
9d39892e75
commit
ddea816a49
6 changed files with 50 additions and 20 deletions
28
my/stackexchange/stexport.py
Normal file
28
my/stackexchange/stexport.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue