I'm trying to connect to bluesky using atproto
:
bsky_handle = "_____.bsky.social"
bsky_password = "____-____-____-____"
from atproto import Client
bsky = Client()
bsky.login(bsky_handle, bsky_password)
(Taken from https://github.com/Linus2punkt0/bluesky-crossposter/blob/main/crosspost.py)
But that last line gives me the following error:
Traceback (most recent call last):
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\models\utils.py:87 in _get_or_create
return model(**model_data)
File ~\Anaconda3\anaconda3\lib\site-packages\pydantic\main.py:165 in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
ValidationError: 1 validation error for Response
emailConfirmed
Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool]
For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
Cell In[12], line 2
bsky.login(bsky_handle, bsky_password)
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\client\client.py:74 in login
session = self._get_and_set_session(login, password)
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\client\client.py:37 in _get_and_set_session
session = self.com.atproto.server.create_session(
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\namespaces\sync_ns.py:1757 in create_session
return get_response_model(response, models.ComAtprotoServerCreateSession.Response)
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\models\utils.py:98 in get_response_model
return get_or_create(response.content, model)
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\models\utils.py:64 in get_or_create
raise e
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\models\utils.py:57 in get_or_create
model_instance = _get_or_create(model_data, model, strict=strict)
File ~\Anaconda3\anaconda3\lib\site-packages\atproto\xrpc_client\models\utils.py:89 in _get_or_create
raise ModelError(str(e)) from e
ModelError: 1 validation error for Response
emailConfirmed
Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool]
For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
What am I doing wrong?
The problem is that your local version of atproto package is not the latest one. This is a general issue for now because models of SDK are generated using schemes (lexicons). And this lexicon is not versioning for now (until AT Protocol is not finished). Maybe Python SDK will allow unexpected fields in the future to fix some of such issues, but for now, you should keep SDK up to date.
To update you SDK use this command:
pip install -U atproto
Upd. Since v0.0.34 SDK is more backward and forward-compatible with protocol.