Skip to content

Commit

Permalink
Update JSONParser.feed() to take a file instead of a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed May 22, 2022
1 parent 3ea1c54 commit 0806be0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion feedparser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def _parse_file_inplace(
result['version'] = None
feed_parser = JSONParser(baseuri, baselang, 'utf-8')
try:
feed_parser.feed(data)
feed_parser.feed(io.BytesIO(data))
except Exception as e:
result['bozo'] = 1
result['bozo_exception'] = e
Expand Down
4 changes: 2 additions & 2 deletions feedparser/parsers/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __init__(self, baseuri=None, baselang=None, encoding=None):
self.namespacesInUse = []
self.entries = []

def feed(self, data):
data = json.loads(data)
def feed(self, file):
data = json.load(file)

v = data.get('version', '')
try:
Expand Down

0 comments on commit 0806be0

Please sign in to comment.