Skip to content

Instantly share code, notes, and snippets.

@sambos
Last active January 20, 2017 16:49
Show Gist options
  • Save sambos/c6856c75825e5ebe62e1c1a6fb152b26 to your computer and use it in GitHub Desktop.
Save sambos/c6856c75825e5ebe62e1c1a6fb152b26 to your computer and use it in GitHub Desktop.
Useful scrpits
#!/usr/bin/env python
# curl equivalent:
# curl --negotiate -u:userid "http://localhost:11000/oozie?job=x" -H 'Content-type:text/xml'
import urllib2
import json
import pycurl
#req = urllib2.Request('http://localhost:11000/oozie/v1/jobs?jobtype=wf')
#response = urllib2.urlopen(req)
#output = response.read()
#print json.dumps(json.loads(output), indent=4, separators=(',', ': '))
curl = pycurl.Curl()
curl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_GSSNEGOTIATE)
curl.setopt(pycurl.USERPWD, ':')
curl.setopt(pycurl.URL, 'http://localhost:11000/oozie/v1/jobs?jobtype=wf')
curl.perform()
curl.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment