SpamExperts / pyzor

Pyzor is a Python implementation of a spam-blocking networked system that use spam signatures to identify them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'module' object has no attribute 'get_digest'

cleder opened this issue · comments

on http://pyzor.readthedocs.org/en/release-1-0-0/pyzor.client.html the documentation says:

>>> digest = pyzor.digest.get_digest(msg)

I get
>>> import pyzor.digest
>>> pyzor.digest.get_digest
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'get_digest'

The documentation needs updating here. The new method of getting the digest is:

>>> import pyzor.digest
>>> pyzor.digest.DataDigester(msg).value
'c3a8e8d987f07843792d2ab1823b04cc3cb87482'

When I execute this

>>> import pyzor.digest
>>> pyzor.digest.DataDigester(msg).value

I get:

Traceback (most recent call last):
File "", line 1, in
File "/home/vmlellis/.local/lib/python2.7/site-packages/pyzor/digest.py", line 82, in init
for payload in self.digest_payloads(msg):
File "/home/vmlellis/.local/lib/python2.7/site-packages/pyzor/digest.py", line 147, in digest_payloads
for part in msg.walk():
AttributeError: 'str' object has no attribute 'walk'

@vmlellis is your msg an email.message.Message object? It looks like it's a string. If you want to convert a string in RFC 5322 format to email.message.Message you can use email.message_from_string (see the standard library documentation for more details).

Spent half an hour looking for this.
Please update documentation. Half a year is way too long for this simple but needed update.

Updated in #60

Thanks for the pull request: 👍

Nah, thanks for the badass library 👍