-
So far this was the only way I figured out to get an account's display name, but since the network is a public network, it feels like I should be able to do this without logging in or providing my own credentials from atproto import Client, IdResolver
HANDLE = os.environ.get('BSKY_HANDLE', None)
PASSWORD = os.environ.get('BSKY_PASSWORD', None)
''' some Django model
....
'''
def get_display_name(self):
client = Client()
client.login(HANDLE, PASSWORD)
did = IdResolver().handle.resolve(self.hnd_base + self.hnd_sfx.suffix)
return client.get_profile(did).display_name I guess it feels wrong because I resolve a handle into a DID without logging in: def get_did(self):
resolver = IdResolver()
did = resolver.handle.resolve(self.hnd_base + self.hnd_sfx.suffix)
return did |
Beta Was this translation helpful? Give feedback.
Answered by
MarshalX
Feb 29, 2024
Replies: 1 comment 1 reply
-
You should use different base URL. You should use the URL which is used for "non authed" access to bsky.app from the browser. from atproto import Client
client = Client(base_url='https://api.bsky.app')
profile = client.app.bsky.actor.get_profile({'actor': 'test.marshal.dev'})
print(profile.display_name) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
venteto
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should use different base URL. You should use the URL which is used for "non authed" access to bsky.app from the browser.