aboutsummaryrefslogtreecommitdiffstats
path: root/termcast_client
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-22 23:05:30 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-22 23:20:23 -0400
commit931ebeabf4a378b303f6868d34ca66b433d28188 (patch)
treebee094449a09d7f857478abc450c120300320d6d /termcast_client
parent10b2ea0a4876a9ecaae7ab58265ad623b2aa7027 (diff)
downloadpython-termcast-client-931ebeabf4a378b303f6868d34ca66b433d28188.tar.gz
python-termcast-client-931ebeabf4a378b303f6868d34ca66b433d28188.zip
package this up as a script
Diffstat (limited to 'termcast_client')
-rw-r--r--termcast_client/__init__.py5
-rw-r--r--termcast_client/__main__.py2
2 files changed, 5 insertions, 2 deletions
diff --git a/termcast_client/__init__.py b/termcast_client/__init__.py
index 64e6c2a..c3c8a55 100644
--- a/termcast_client/__init__.py
+++ b/termcast_client/__init__.py
@@ -1,12 +1,13 @@
import argparse
import json
import os
-import pity
import shutil
import signal
import socket
import sys
+from . import pity
+
class Client(object):
def __init__(self, host, port, username, password):
self.host = host
@@ -71,7 +72,7 @@ class Client(object):
def _build_metadata_string(self, data):
return b'\033]499;' + json.dumps(data).encode('utf-8') + b'\007'
-if __name__ == '__main__':
+def main():
parser = argparse.ArgumentParser()
parser.add_argument('--host', default="noway.ratry.ru")
parser.add_argument('--port', type=int, default=31337)
diff --git a/termcast_client/__main__.py b/termcast_client/__main__.py
new file mode 100644
index 0000000..f30a76b
--- /dev/null
+++ b/termcast_client/__main__.py
@@ -0,0 +1,2 @@
+import termcast_client
+termcast_client.main()