summaryrefslogtreecommitdiff
path: root/textract
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-11-05 14:07:54 -0800
committerBen Sima <ben@bsima.me>2018-11-05 14:07:54 -0800
commit1ec7b6c43bc264798adec51efcfed7060c9d9c83 (patch)
tree193bffb7121bc4a8d42d120e4e6cf71d0d193b3d /textract
parent099544381c4f703dc4ec7fb6e785bb262ee02276 (diff)
Fix python scripts to work with nix
Diffstat (limited to 'textract')
-rwxr-xr-xtextract6
1 files changed, 4 insertions, 2 deletions
diff --git a/textract b/textract
index 996393f..f80be36 100755
--- a/textract
+++ b/textract
@@ -1,4 +1,5 @@
-#!/usr/bin/env python3.5
+#! /usr/bin/env nix-shell
+#! nix-shell -i python -p "python3.withPackages(p: [p.requests p.pyreadability])"
import argparse
from readability import Document
@@ -9,11 +10,12 @@ cli = argparse.ArgumentParser('read a url')
cli.add_argument('url', type=str)
if __name__ == '__main__':
+ args = cli.parse_args()
try:
- args = cli.parse_args()
resp = requests.get(args.url)
doc = Document(resp.text)
sys.stdout.write(doc.summary())
sys.exit(0)
except:
+ print("Could not fetch document.")
sys.exit(1)