Skip to content

Instantly share code, notes, and snippets.

@dreynolds
Last active November 9, 2016 15:06
Show Gist options
  • Save dreynolds/021d343dcd6e9e21f416ec53fbff444b to your computer and use it in GitHub Desktop.
Save dreynolds/021d343dcd6e9e21f416ec53fbff444b to your computer and use it in GitHub Desktop.
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/usr/bin/env python2.7
'''
This
is
a
multi
line
docstring.
'''
import sys
import xmlrpclib
server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
def create(session_id, app_name, home):
"""Create the application."""
app_info = server.create_app(session_id, app_name, 'static_php70')
print app_info['id']
def delete(session_id, app_name):
"""Delete the application and its database and database user."""
server.delete_app(session_id, app_name)
def main():
username, password, machine, app_name, autostart, extra_info = sys.argv[2:]
session_id = server.login(username, password, machine, 2)[0]
if sys.argv[1] == 'create':
create(session_id, app_name)
else:
delete(session_id, app_name)
if __name__ == '__main__':
main()
-----END WEBFACTION INSTALL SCRIPT-----
-----BEGIN WEBFACTION INSTALL SCRIPT-----
#!/usr/bin/env python2.7
'''This is a docstring.'''
import sys
import xmlrpclib
server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
def create(session_id, app_name, home):
"""Create the application."""
app_info = server.create_app(session_id, app_name, 'static_php70')
print app_info['id']
def delete(session_id, app_name):
"""Delete the application and its database and database user."""
server.delete_app(session_id, app_name)
def main():
username, password, machine, app_name, autostart, extra_info = sys.argv[2:]
session_id = server.login(username, password, machine, 2)[0]
if sys.argv[1] == 'create':
create(session_id, app_name)
else:
delete(session_id, app_name)
if __name__ == '__main__':
main()
-----END WEBFACTION INSTALL SCRIPT-----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment