Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _start_textinput(self, attrsD):
self.intextinput = 1
self.push('textinput', 0)
context = self._getContext()
context.setdefault('textinput', FeedParserDict())
_start_textInput = _start_textinputdef _start_body(self, attrsD):
self.incontent += 1
self.contentparams = FeedParserDict({'mode': 'xml',
'type': 'application/xhtml+xml',
'language': attrsD.get('xml:lang', self.lang),
'base': attrsD.get('xml:base', self.baseuri)})
self.push('content', 1)
_start_xhtml_body = _start_bodydef parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]):
"""Parse a feed from a URL, file, stream, or string"""
result = FeedParserDict()
result['feed'] = FeedParserDict()
result['entries'] = []
if _XML_AVAILABLE:
result['bozo'] = 0
if type(handlers) == types.InstanceType:
handlers = [handlers]
try:
f = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers)
data = f.read()
except Exception, e:
result['bozo'] = 1
result['bozo_exception'] = e
data = ''
f = None
# if feed is gzip-compressed, decompress itdef _start_source(self, attrsD):
if self.inentry:
self.entries[-1]['source'] = FeedParserDict(attrsD)
self.push('source', 1)def _start_content_encoded(self, attrsD):
self.incontent += 1
self.contentparams = FeedParserDict({'mode': 'escaped',
'type': 'text/html',
'language': attrsD.get('xml:lang', self.lang),
'base': attrsD.get('xml:base', self.baseuri)})
self.push('content', 1)
_start_fullitem = _start_content_encodeddef _save_author(self, key, value):
context = self._getContext()
context.setdefault('author_detail', FeedParserDict())
context['author_detail'][key] = value
self._sync_author_detail()def _start_copyright(self, attrsD):
self.incontent += 1
self.contentparams = FeedParserDict({'mode': attrsD.get('mode', 'escaped'),
'type': attrsD.get('type', 'text/plain'),
'language': attrsD.get('xml:lang', self.lang),
'base': attrsD.get('xml:base', self.baseuri)})
self.push('copyright', 1)
_start_dc_rights = _start_copyrightdef _start_title(self, attrsD):
self.incontent += 1
self.contentparams = FeedParserDict({'mode': attrsD.get('mode', 'escaped'),
'type': attrsD.get('type', 'text/plain'),
'language': attrsD.get('xml:lang', self.lang),
'base': attrsD.get('xml:base', self.baseuri)})
self.push('title', self.infeed or self.inentry)
_start_dc_title = _start_titledef _save_contributor(self, key, value):
context = self._getContext()
context.setdefault('contributors', [FeedParserDict()])
context['contributors'][-1][key] = value