internetarchive / internetarchive/warc

Bug in WARCRecord.__repr__()

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
250
Forks
114
PR merge metrics
No merged PRs in 30d

Description

The line in **repr**:

return "" % (self['type'], self['record_id'])

results in an error. I don't know if the above line is wrong or whether there's a bug in how the attribute lookup chain is supposed to work. Changing the above line to this works though:

return "" % (self.header.type, self.header.record_id)

Traceback below.

---

> > > h=WARCHeader({"WARC-Type": "response"}, defaults=True)
> > > r = WARCRecord(h)
> > > r
> > > Traceback (most recent call last):
> > > File "", line 1, in
> > > File "**init**.py", line 186, in **repr**
> > > return "" % (self['type'], self['record_id'])
> > > File "**init**.py", line 172, in **getitem**
> > > return self.header[name]
> > > File "**init**.py", line 40, in **getitem**
> > > return self._d[name.lower()]
> > > KeyError: 'type'

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.