Closed StuBlad closed 1 year ago
Thanks for the stacktrace. I've pushed a code change that will show the entire error. Can you try again and share what it says?
I have the most recent version and getting this:
cursor = 1682885319815::bafyreic7u3ccopzjqcjokgzbeacvli2hnakjwekoqfrwkbfihrbv3yfko4
13392 posts total
12641 hellthread posts total
Deleting https://bsky.app/profile/did:plc:*****
Traceback (most recent call last):
File "/Users/matty.stratton/src/github.com/jcsalterego/Constantine/./delete_hellthreads.py", line 137, in <module>
main()
File "/Users/matty.stratton/src/github.com/jcsalterego/Constantine/./delete_hellthreads.py", line 128, in main
delete_post(session, uri)
File "/Users/matty.stratton/src/github.com/jcsalterego/Constantine/./delete_hellthreads.py", line 95, in delete_post
return post_xrpc(session, "com.atproto.repo.deleteRecord", json=json)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/matty.stratton/src/github.com/jcsalterego/Constantine/constantine.py", line 56, in post_xrpc
text = response.text()
^^^^^^^^^^^^^^^
TypeError: 'str' object is not callable
( redacted the DID for privacy)
@mattstratton Thanks for testing. Embarrassing code change on my part. Can you give it a shot again?
@jcsalterego Hey. I pulled the latest commit and got this:
Stu@StuLaptop:~/Constantine$ ./delete_hellthreads.py stublad.renoproject.org
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
cursor = <scrubbed>
1171 posts total
79 hellthread posts total
Deleting https://bsky.app/profile/<scrubbed>
Traceback (most recent call last):
File "/home/Stu/Constantine/constantine.py", line 58, in post_xrpc
return json.loads(text)
AttributeError: 'dict' object has no attribute 'loads'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/Stu/Constantine/./delete_hellthreads.py", line 137, in <module>
main()
File "/home/Stu/Constantine/./delete_hellthreads.py", line 128, in main
delete_post(session, uri)
File "/home/Stu/Constantine/./delete_hellthreads.py", line 95, in delete_post
return post_xrpc(session, "com.atproto.repo.deleteRecord", json=json)
File "/home/Stu/Constantine/constantine.py", line 59, in post_xrpc
except json.JSONDecodeError:
AttributeError: 'dict' object has no attribute 'JSONDecodeError'
yeah I got that too. The following patch (or something similar) fixes it:
diff --git a/constantine.py b/constantine.py
index 0d95543..ab68dea 100755
--- a/constantine.py
+++ b/constantine.py
@@ -46,10 +46,10 @@ def get_xrpc(session, endpoint, params={}):
return response.json()
-def post_xrpc(session, endpoint, json={}):
+def post_xrpc(session, endpoint, jsonBody={}):
response = requests.post(
f"https://bsky.social/xrpc/{endpoint}",
- json=json,
+ json=jsonBody,
headers={"Authorization": f"Bearer {session['accessJwt']}"},
)
if response.status_code == 200:
diff --git a/delete_hellthreads.py b/delete_hellthreads.py
index b264998..1b39622 100755
--- a/delete_hellthreads.py
+++ b/delete_hellthreads.py
@@ -92,7 +92,7 @@ def delete_post(session, uri):
"repo": did,
"rkey": rkey,
}
- return post_xrpc(session, "com.atproto.repo.deleteRecord", json=json)
+ return post_xrpc(session, "com.atproto.repo.deleteRecord", jsonBody=json)
return None
yeah I got that too. The following patch (or something similar) fixes it:
diff --git a/constantine.py b/constantine.py index 0d95543..ab68dea 100755 --- a/constantine.py +++ b/constantine.py @@ -46,10 +46,10 @@ def get_xrpc(session, endpoint, params={}): return response.json() -def post_xrpc(session, endpoint, json={}): +def post_xrpc(session, endpoint, jsonBody={}): response = requests.post( f"https://bsky.social/xrpc/{endpoint}", - json=json, + json=jsonBody, headers={"Authorization": f"Bearer {session['accessJwt']}"}, ) if response.status_code == 200: diff --git a/delete_hellthreads.py b/delete_hellthreads.py index b264998..1b39622 100755 --- a/delete_hellthreads.py +++ b/delete_hellthreads.py @@ -92,7 +92,7 @@ def delete_post(session, uri): "repo": did, "rkey": rkey, } - return post_xrpc(session, "com.atproto.repo.deleteRecord", json=json) + return post_xrpc(session, "com.atproto.repo.deleteRecord", jsonBody=json) return None
I applied the patch you shared and get this stack trace:
Traceback (most recent call last):
File "/home/Stu/Constantine/./delete_hellthreads.py", line 137, in <module>
main()
File "/home/Stu/Constantine/./delete_hellthreads.py", line 128, in main
delete_post(session, uri)
File "/home/Stu/Constantine/./delete_hellthreads.py", line 95, in delete_post
return post_xrpc(session, "com.atproto.repo.deleteRecord", jsonBody=json)
TypeError: post_xrpc() got an unexpected keyword argument 'jsonBody'
Thanks @mmarchini for the patch. Thanks @StuBlad @mattstratton for testing. I'll get this fixed later today. I'm a dummy!
Hi all, thanks for your patience. We should be good now - please try the latest.
Thanks again to @mmarchini for pointing out that I was shadowing json
🤦♂️
It’s working for me now! Thank you!!!
I can confirm this fixed it for me too. Thanks everyone! Closing this issue out.
Thanks all
I succesfully setup a local copy of Constantine in WSL2 and was able to use
get_helltheads.py
just fine but when i calldelete_hellthreads.py stublad.renoproject.org
, it attempts to delete a post and then dies.I'm using WSL2 and Python 3.10.6.
Here's the output: