reorganize scripts

This commit is contained in:
Edmund Huber 2014-05-10 19:31:21 +02:00
parent 60b1f37576
commit 57358a56df
8 changed files with 47 additions and 58 deletions

13
bin/purge_key Normal file
View file

@ -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)

13
bin/purge_service Normal file
View file

@ -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)

13
bin/purge_url Normal file
View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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"
]
},
)