From 20df7d0e3a83ad3abf09ee2ebf38810869c26125 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 31 Jul 2012 15:15:41 +0200 Subject: [PATCH] Remove JSON and XML encoding support JSON/XML support doesn't make a lot of sense here, should be done by calling code. --- opengraph/opengraph.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/opengraph/opengraph.py b/opengraph/opengraph.py index 2fa1356..0d7689e 100644 --- a/opengraph/opengraph.py +++ b/opengraph/opengraph.py @@ -7,13 +7,6 @@ except ImportError: from BeautifulSoup import BeautifulSoup -global import_json -try: - import json - import_json = True -except ImportError: - import_json = False - class OpenGraph(dict): """ """ @@ -85,20 +78,6 @@ def to_html(self): meta += u"\n" return meta - - def to_json(self): - # TODO: force unicode - global import_json - if not import_json: - return "{'error':'there isn't json module'}" - - if not self.is_valid(): - return json.dumps({'error':'og metadata is not valid'}) - - return json.dumps(self) - - def to_xml(self): - pass def scrape_image(self, doc): images = [dict(img.attrs)['src']