eigenmagic / fediblockhole

A tool for automatically syncing Mastodon admin domain blocks.
GNU Affero General Public License v3.0
70 stars 7 forks source link

AttributeError: 'dict' object has no attribute '_asdict' after update to 0.4.1 #30

Closed lnlyssg closed 1 year ago

lnlyssg commented 1 year ago

I successfully used 0.4.0 to pull the mastodon.social blocklist and populate my own. I just updated the tool to 0.4.1 but now it's failing:


❯ fediblock-sync
2023-01-17 16:28:34,663 INFO Fetching domain blocks from URLs...
2023-01-17 16:28:34,663 INFO Fetching domain blocks from instances...
2023-01-17 16:28:34,663 INFO Fetching instance blocklist from mastodon.social ...
2023-01-17 16:28:34,954 INFO Removing domains from URL allowlists...
2023-01-17 16:28:34,954 INFO Pushing domain blocks to instances...
2023-01-17 16:28:34,954 INFO Pushing blocklist to host social.racf.guru ...
2023-01-17 16:28:34,954 INFO Fetching instance blocklist from social.racf.guru ...
2023-01-17 16:28:35,192 INFO Change detected. Need to update ['reject_media', 'reject_reports', 'obfuscate'] for domain block for bgzashtita.es
2023-01-17 16:28:35,192 INFO Old block definition: <DomainBlock {'domain': 'bgzashtita.es', 'severity': 'silence', 'public_comment': '', 'private_comment': '', 'reject_media': True, 'reject_reports': True, 'obfuscate': True, 'id': '4'}>
2023-01-17 16:28:35,192 INFO Pushing new block definition: <DomainBlock {'domain': 'bgzashtita.es', 'severity': 'silence', 'public_comment': '', 'private_comment': '', 'reject_media': False, 'reject_reports': False, 'obfuscate': False}>
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/fediblock-sync", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/.local/lib/python3.10/site-packages/fediblockhole/__init__.py", line 726, in main
    sync_blocklists(args)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/fediblockhole/__init__.py", line 92, in sync_blocklists
    push_blocklist(token, domain, merged.values(), conf.dryrun, import_fields, max_followed_severity)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/fediblockhole/__init__.py", line 564, in push_blocklist
    update_known_block(token, host, blockdata)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/fediblockhole/__init__.py", line 479, in update_known_block
    json=blockdata._asdict(),
AttributeError: 'dict' object has no attribute '_asdict'
sgrigson commented 1 year ago

I'm now getting this, now that I'm trying to sync for the first time.

2023-01-17 23:03:34,920 INFO Adding new block: <DomainBlock {'domain': 'activitypub-proxy.cf', 'severity': 'suspend', 'public_comment': '', 'private_comment': '', 'reject_media': False, 'reject_reports': False, 'obfuscate': False}>...
2023-01-17 23:03:38,149 INFO Change detected. Need to update ['public_comment'] for domain block for activitypub-troll.cf
2023-01-17 23:03:38,150 INFO Old block definition: <DomainBlock {'domain': 'activitypub-troll.cf', 'severity': 'suspend', 'public_comment': 'Disallowed Content', 'private_comment': '', 'reject_media': False, 'reject_reports': False, 'obfuscate': False, 'id': '290'}>
2023-01-17 23:03:38,150 INFO Pushing new block definition: <DomainBlock {'domain': 'activitypub-troll.cf', 'severity': 'suspend', 'public_comment': '', 'private_comment': '', 'reject_media': False, 'reject_reports': False, 'obfuscate': False}>
Traceback (most recent call last):
  File "/usr/local/bin/fediblock-sync", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/fediblockhole/__init__.py", line 726, in main
    sync_blocklists(args)
  File "/usr/local/lib/python3.10/dist-packages/fediblockhole/__init__.py", line 92, in sync_blocklists
    push_blocklist(token, domain, merged.values(), conf.dryrun, import_fields, max_followed_severity)
  File "/usr/local/lib/python3.10/dist-packages/fediblockhole/__init__.py", line 564, in push_blocklist
    update_known_block(token, host, blockdata)
  File "/usr/local/lib/python3.10/dist-packages/fediblockhole/__init__.py", line 479, in update_known_block
    json=blockdata._asdict(),
AttributeError: 'dict' object has no attribute '_asdict'
jpwarren commented 1 year ago

Fixed by #31