Skip to content

Commit

Permalink
allow to pass the xml by content instead of url, keeping backward com…
Browse files Browse the repository at this point in the history
…patibility
  • Loading branch information
not-a-kiwi committed Jun 10, 2011
1 parent 42bfa66 commit 63dd1a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PyOpenGraph/PyOpenGraph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#Copyright (c) 2010 Gerson Minichiello
#
Expand Down Expand Up @@ -30,9 +31,12 @@

class PyOpenGraph(object):

def __init__(self, url):
def __init__(self, url=None, xml=None):
parser = rdfadict.RdfaParser()
result = parser.parse_url(url)
if not xml:
result = parser.parse_url(url)
else:
result = parser.parse_string(xml, url)
data = result[url]
self.metadata = self.get_properties(data)

Expand Down

0 comments on commit 63dd1a8

Please sign in to comment.