diff --git a/bin/purge_key b/bin/purge_key new file mode 100644 index 0000000..ef5d474 --- /dev/null +++ b/bin/purge_key @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import sys, fastly + +if len(sys.argv) < 4: + print "not enough arguments!" + sys.exit() +else: + _, auth_key, svc_key, purge_key = sys.argv + +api = fastly.API() +api.authenticate_by_key(auth_key) +api.purge_key(svc_key, purge_key) diff --git a/bin/purge_service b/bin/purge_service new file mode 100644 index 0000000..74800cb --- /dev/null +++ b/bin/purge_service @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import sys, fastly + +if len(sys.argv) < 3: + print "not enough arguments!" + sys.exit() +else: + _, auth_key, svc_key = sys.argv + +api = fastly.API() +api.authenticate_by_key(auth_key) +api.purge_service(svc_key) diff --git a/bin/purge_url b/bin/purge_url new file mode 100644 index 0000000..378f40e --- /dev/null +++ b/bin/purge_url @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +import sys, fastly + +if len(sys.argv) < 4: + print "not enough arguments!" + sys.exit() +else: + _, auth_key, url_host, url_path = sys.argv + +api = fastly.API() +api.authenticate_by_key(auth_key) +api.purge_url(url_host, url_path) diff --git a/fastly/scripts/__init__.py b/fastly/scripts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/fastly/scripts/purge_key.py b/fastly/scripts/purge_key.py deleted file mode 100644 index 1d68df7..0000000 --- a/fastly/scripts/purge_key.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys, fastly - -def purge_key(): - if len(sys.argv) < 4: - print "not enough arguments!" - exit() - else: - auth_key = sys.argv[1] - svc_key = sys.argv[2] - purge_key = sys.argv[3] - - api = fastly.API() - api.authenticate_by_key(auth_key) - api.purge_key(svc_key, purge_key) - diff --git a/fastly/scripts/purge_service.py b/fastly/scripts/purge_service.py deleted file mode 100644 index 5b97173..0000000 --- a/fastly/scripts/purge_service.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys, fastly - -def purge_service(): - if len(sys.argv) < 3: - print "not enough arguments!" - exit() - else: - auth_key = sys.argv[1] - svc_key = sys.argv[2] - - api = fastly.API() - api.authenticate_by_key(auth_key) - api.purge_service(svc_key) - diff --git a/fastly/scripts/purge_url.py b/fastly/scripts/purge_url.py deleted file mode 100644 index dcea0ae..0000000 --- a/fastly/scripts/purge_url.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys, fastly - -def purge_url(): - if len(sys.argv) < 4: - print "not enough arguments!" - exit() - else: - auth_key = sys.argv[1] - url_host = sys.argv[2] - url_path = sys.argv[3] - - api = fastly.API() - api.authenticate_by_key(auth_key) - api.purge_url(url_host,url_path) - diff --git a/setup.py b/setup.py index 5ce6e1c..6614f44 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,4 @@ -import os -from setuptools import setup, find_packages - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() +from setuptools import setup setup( name="fastly", @@ -12,8 +8,8 @@ setup( description="Fastly python API", keywords="fastly api", url="https://github.com/fastly/fastly-py", - packages=find_packages(), - long_description=read('README'), + packages=['fastly'], + long_description=open('README').read(), classifiers=[ "Operating System :: OS Independent", "Programming Language :: Python", @@ -21,11 +17,9 @@ setup( "Development Status :: 3 - Alpha", "Topic :: Utilities" ], - entry_points={ - 'console_scripts': [ - 'purge_service = fastly.scripts.purge_service:purge_service', - 'purge_key = fastly.scripts.purge_key:purge_key', - 'purge_url = fastly.scripts.purge_url:purge_url', - ] - }, + scripts=[ + "bin/purge_service", + "bin/purge_key", + "bin/purge_url" + ] )