Rename dir to path
This commit is contained in:
parent
16b8878717
commit
0b0a8c2afc
2 changed files with 30 additions and 13 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
"""
|
||||||
|
Uses instapaper API data export JSON file.
|
||||||
|
|
||||||
|
Set via
|
||||||
|
- ~configure~ method
|
||||||
|
- or in ~my_configuration.instpaper.export_path~
|
||||||
|
|
||||||
|
TODO upload my exporter script to github..
|
||||||
|
"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -9,22 +18,21 @@ import pytz
|
||||||
from .common import group_by_key, PathIsh
|
from .common import group_by_key, PathIsh
|
||||||
|
|
||||||
|
|
||||||
_export_dir: Optional[Path] = None
|
_export_path: Optional[Path] = None
|
||||||
|
def configure(*, export_path: Optional[PathIsh]=None) -> None:
|
||||||
|
if export_path is not None:
|
||||||
def configure(*, export_dir: Optional[PathIsh]=None) -> None:
|
global _export_path
|
||||||
if export_dir is not None:
|
_export_path = Path(export_path)
|
||||||
global _export_dir
|
|
||||||
_export_dir = Path(export_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_files():
|
def _get_files():
|
||||||
export_dir = _export_dir
|
# TODO use helper method from common to get json[s]?
|
||||||
if export_dir is None:
|
export_path = _export_path
|
||||||
|
if export_path is None:
|
||||||
# fallback to my_configuration
|
# fallback to my_configuration
|
||||||
from . import paths
|
from . import paths
|
||||||
export_dir = paths.instapexport.export_dir
|
export_path = paths.instapaper.export_path
|
||||||
return list(sorted(Path(export_dir).glob('*.json')))
|
return list(sorted(Path(export_path).glob('*.json')))
|
||||||
|
|
||||||
|
|
||||||
Bid = str
|
Bid = str
|
||||||
|
|
13
my/tweets.py
13
my/tweets.py
|
@ -1,4 +1,14 @@
|
||||||
#!/usr/bin/env python3
|
"""
|
||||||
|
Uses official twitter archive export
|
||||||
|
|
||||||
|
See https://help.twitter.com/en/managing-your-account/how-to-download-your-twitter-archive
|
||||||
|
|
||||||
|
Expects path to be set
|
||||||
|
- via ~configure~ (before calling anything else)
|
||||||
|
- or in ~my_configuration.twitter.export_path~
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Union, List, Dict, Set, Optional, Iterator, Any
|
from typing import Union, List, Dict, Set, Optional, Iterator, Any
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -11,7 +21,6 @@ from .common import PathIsh
|
||||||
|
|
||||||
|
|
||||||
_export_path: Optional[Path] = None
|
_export_path: Optional[Path] = None
|
||||||
|
|
||||||
def configure(*, export_path: Optional[PathIsh]=None) -> None:
|
def configure(*, export_path: Optional[PathIsh]=None) -> None:
|
||||||
if export_path is not None:
|
if export_path is not None:
|
||||||
global _export_path
|
global _export_path
|
||||||
|
|
Loading…
Add table
Reference in a new issue