IgnoredAmbience / yahoo-group-archiver

Scrapes and archives a Yahoo groups email archives, photo galleries and file contents using the non-public API
MIT License
93 stars 46 forks source link

ERROR "User doesn't have permission to access Messages in this group" #77

Closed blowfish64 closed 4 years ago

blowfish64 commented 4 years ago

I'm using 2791b35 commit. When I attempt to archive a group which does not have the message history feature enabled, I get the error message "User doesn't have permission to access Messages in this group", and then the script crashes. While the group in question actually does not have message history even in the Web interface, I expected the script to just skip message fetching altogether and head over. The log reports the following:

2019-10-27 22:10:14.353 CET DEBUG urllib3.connectionpool Starting new HTTPS connection (1): groups.yahoo.com:443 2019-10-27 22:10:15.131CET DEBUG urllib3.connectionpool https://groups.yahoo.com:443 "GET /api/v1/groups/MiM_Pioneer/messages HTTP/1.1" 403 None 2019-10-27 22:10:15.132 CET DEBUG YahooGroupsAPI Exception raised on uri: https://groups.yahoo.com/api/v1/groups/MiM_Pioneer/messages 2019-10-27 22:10:15.132 CET DEBUG YahooGroupsAPI b'{"ygPerms":{"resourceCapabilityList":[{"resourceType":"GROUP","capabilities":[{"name":"READ"},{"name":"WELCOME_MSG"}]},{"resourceType":"PHOTO","capabilities":[{"name":"READ"},{"name":"UPLOAD"},{"name":"UPLOADTEMP"}]},{"resourceType":"FILE","capabilities":[{"name":"READ"},{"name":"CREATE"}]},{"resourceType":"MEMBER","capabilities":[]},{"resourceType":"LINK","capabilities":[]},{"resourceType":"CALENDAR","capabilities":[]},{"resourceType":"DATABASE","capabilities":[]},{"resourceType":"POLL","capabilities":[]},{"resourceType":"MESSAGE","capabilities":[]},{"resourceType":"PENDING_MESSAGE","capabilities":[]},{"resourceType":"ATTACHMENTS","capabilities":[]},{"resourceType":"PHOTOMATIC_ALBUMS","capabilities":[]},{"resourceType":"MEMBERSHIP_TYPE","capabilities":[{"name":"READ"}]},{"resourceType":"POST","capabilities":[]},{"resourceType":"PIN","capabilities":[{"name":"READ"},{"name":"DELETE"},{"name":"UPDATE"},{"name":"CREATE"}]}],"subStatus":"NORMAL","groupUrl":"it.groups.yahoo.com","intlCode":"it"},"ygError":{"hostname":"gapi4.grp.bf1.yahoo.com","httpStatus":403,"errorMessage":"User does not have READ permission for MESSAGE. Me...","errorCode":1203,"sid":"SID:YHOO:groups.yahoo.com:0ca0ad84220c8d95bdc33c8893fea96f:0"}}'

Observing the JSON file, at the very end it reads clearly "User does not have READ permission for MESSAGE"

Also, the traceback is as follows:

Traceback (most recent call last): File "R:\yahoo-group-archiver-master\yahoo.py", line 126, in archive_email yga.messages() File "R:\yahoo-group-archiver-master\yahoogroupsapi.py", line 110, in get_json

raise e File "R:\yahoo-group-archiver-master\yahoogroupsapi.py", line 103, in get_json

r.raise_for_status() File "C:\Program Files (x86)\Python38-32\lib\site-packages\requests\models.py" , line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://grou ps.yahoo.com/api/v1/groups/MiM_Pioneer/messages

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "R:\yahoo-group-archiver-master\yahoo.py", line 693, in archive_email(yga) File "R:\yahoo-group-archiver-master\yahoo.py", line 128, in archive_email logger.error("User doesn't have permission to access Messages in this group" , err.message) AttributeError: 'HTTPError' object has no attribute 'message'

The script works just fine with any other group that does not have such feature limitation, also, it works even just by commeting out the archive_email(yga) call, but obviously this is not a general solution. EDIT: actually, it worked out by editing line #128 in yahoo.py from logger.error("User doesn't have permission to access Messages in this group", err.message) to logger.error("User doesn't have permission to access Messages in this group") This way, the error is reported on the log, but the script goes on anyway

d235j commented 4 years ago

Fixed by https://github.com/IgnoredAmbience/yahoo-group-archiver/pull/79