This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Código original | |
import httplib | |
import urlparse | |
def unshorten_url(url): | |
parsed = urlparse.urlparse(url) | |
h = httplib.HTTPConnection(parsed.netloc) | |
resource = parsed.path | |
if parsed.query != "": | |
resource += "?" + parsed.query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unshorten error at URL: http://t.co/0AMa7HVsL8 | |
Unshorten error at URL: http://t.co/wxWQpQB6lD | |
Unshorten error at URL: http://t.co/wxWQpQB6lD | |
Unshorten error at URL: http://t.co/o17p11agSh | |
Unshorten error at URL: http://t.c | |
Unshorten error at URL: http:// | |
Unshorten error at URL: http://t | |
Unshorten error at URL: http:/ | |
Unshorten error at URL: http:// | |
Unshorten error at URL: http://t.co/Gk6FxA8E6Z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Correção feita com ajuda de Bernardo Torres (https://github.com/bernardotorres) | |
from xml.etree import cElementTree | |
with open('teste.xml') as arquivo: | |
xml_content = arquivo.read() | |
content = cElementTree.fromstring(xml_content) | |
namespaces = { | |
'wiki': 'http://www.mediawiki.org/xml/export-0.10/' |