summaryrefslogtreecommitdiff
path: root/textract
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-05-19 14:16:19 -0700
committerBen Sima <ben@bsima.me>2019-05-19 14:16:19 -0700
commit95a3cb30f61e90fe00cd859f10e323bbc3e62e99 (patch)
tree6d44b9b5eb04f9279acd31bbaffc95d9d524ae21 /textract
parent517bd3c33f7b34173348141b7128b54e2776a30f (diff)
cleanup textract and rdr
Diffstat (limited to 'textract')
-rwxr-xr-xtextract19
1 files changed, 9 insertions, 10 deletions
diff --git a/textract b/textract
index f80be36..707cd27 100755
--- a/textract
+++ b/textract
@@ -9,13 +9,12 @@ import sys
cli = argparse.ArgumentParser('read a url')
cli.add_argument('url', type=str)
-if __name__ == '__main__':
- args = cli.parse_args()
- try:
- 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)
+args = cli.parse_args()
+
+try:
+ resp = requests.get(args.url)
+ doc = Document(resp.text)
+ sys.stdout.write(doc.summary())
+except:
+ print("textract: Could not fetch document.")
+ sys.exit(1)