Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.com.atproto.repo.describe_repo stopped working in atproto==0.0.49 #379

Open
emilyhunt opened this issue Sep 2, 2024 · 5 comments

Comments

@emilyhunt
Copy link

When trying to use client.com.atproto.repo.describe_repo, from atproto==0.049 onwards & with Python 3.12.1, I get the following error, for multiple different DIDs:

BadRequestError: Response(success=False, status_code=400, content=XrpcError(error='RepoNotFound', message='Could not find repo for DID: did:plc:jcoy7v3a2t4rcfdh6i4kza25'), headers={'x-powered-by': 'Express', 'access-control-allow-origin': '*', 'ratelimit-limit': '3000', 'ratelimit-remaining': '2993', 'ratelimit-reset': '1725272140', 'ratelimit-policy': '3000;w=300', 'content-type': 'application/json; charset=utf-8', 'content-length': '98', 'etag': 'W/"62-CG83jMd+MVjPpLUk0Afdz4DlUTc"', 'vary': 'Accept-Encoding', 'date': 'Mon, 02 Sep 2024 10:15:29 GMT', 'keep-alive': 'timeout=90', 'strict-transport-security': 'max-age=63072000'})

Full traceback: traceback.txt
Contents of pip list for my test with atproto==0.0.49: requirements.txt

The following code should reproduce the bug:

from atproto import client, models

client = Client()
client.login(...)  # Add your details here
params = models.com.atproto.repo.describe_repo.Params(repo="did:plc:jcoy7v3a2t4rcfdh6i4kza25")
client.com.atproto.repo.describe_repo(params)

I tested this code in atproto==0.0.48 (where it worked), in atproto==0.0.49 (where it doesn't work), and also in atproto==0.0.52 (doesn't work).

Thanks!

@emilyhunt
Copy link
Author

(P.S. this isn't urgent as atproto.IdResolver works for what I need and that seems to be fine)

@MarshalX
Copy link
Owner

MarshalX commented Sep 2, 2024

Could not find repo for DID: did:plc:jcoy7v3a2t4rcfdh6i4kza25

did you switch to proper PDS (where this DID is hosted) before calling describe_repo?

Duplicates of #188?

@emilyhunt
Copy link
Author

It's possible that's the problem, but I'm not sure - the code above still works right now with atproto==0.0.48 (which was released June 1st, way after multiple PDSes were implemented).

#188 references a method in atproto.sync, whereas this is in atproto.repo - not sure if that matters.

How... do you switch PDS with the client? The parameters model for the method only has a repo argument, so I'm not sure how to do that. (Sorry!)

@MarshalX
Copy link
Owner

MarshalX commented Sep 2, 2024

Hmm... This is because the "main" bsky PDS is just a proxy to many other PDS... so it can automatically choose the right one. This proxy was in use before 0.0.48, right. But this is not the best way how to deal with it imho.

This is pseudo-code:

did = 'did:123'
resolver = ....
resolved_did = resolve.resolve(did)

client = Client(base_url=resolved_did.get_pds_endpoint())
repo = cllient.describe_repo(did)
print(repo)

@MarshalX
Copy link
Owner

MarshalX commented Sep 2, 2024

probably it could be a cool feature to disable pds auto switching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants