Skip to content

Instantly share code, notes, and snippets.

@fndiaz
Last active May 23, 2017 19:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fndiaz/5879208 to your computer and use it in GitHub Desktop.
Save fndiaz/5879208 to your computer and use it in GitHub Desktop.
requisições http
import urllib2
import urllib
from cookielib import CookieJar
from xml.dom.minidom import parseString
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
response = opener.open("http://192.168.1.100/astmanager/asterisk/mxml?action=login&username=user&secret=senha")
var = response.read()
print var
action = opener.open('http://192.168.1.100/astmanager/asterisk/mxml?action=queuestatus')
var = action.read()
dom = parseString(var)
print dom
xmlTag = dom.getElementsByTagName('response')[0].toxml()
print xmlTag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment