Skip to content

Instantly share code, notes, and snippets.

@conornash
Last active August 23, 2016 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conornash/50e4d2dc525e9c1fdfd77a266971edb8 to your computer and use it in GitHub Desktop.
Save conornash/50e4d2dc525e9c1fdfd77a266971edb8 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import requests_aws4auth as ra
import requests
import json
hyper_endpoint = "https://us-west-1.hyper.sh/v1.23"
hyper_auth = ra.AWS4Auth("ACCESS_KEY", "SECRET_KEY", "us-west-1", "hyper")
print "info \n"
print requests.get(hyper_endpoint + "/info", auth=hyper_auth).json()
print "\n\ncontainer create \n"
hyper_container_create_dict = {
"Env": [
"FOO=bar",
"BAZ=quux"
],
"Cmd": [
"bash"
],
"Image": "ubuntu",
'Labels': {'sh_hyper_instancetype': 's3'},
}
headers = {'content-type': 'application/json'}
test = requests.post(hyper_endpoint + "/containers/create?name=table-stakes",
data=json.dumps(hyper_container_create_dict),
auth=hyper_auth, headers=headers)
print test.request.headers
cont = test.json()["Id"]
test = requests.post(hyper_endpoint + "/containers/{0}/start".format(cont),
auth=hyper_auth)
print "\n"
print test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment