You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using this script in order to get my calendar events:
fromdatetimeimportdatetime, timedeltaapi=PyiCloudService('my_apple_id', 'my_password')
ifapi.requires_2sa:
importclickprint("Two-step authentication required. Your trusted devices are:")
devices=api.trusted_devicesfori, deviceinenumerate(devices):
print(
" %s: %s"% (i, device.get('deviceName',
"SMS to %s"%device.get('phoneNumber')))
)
device=click.prompt('Which device would you like to use?', default=0)
device=devices[device]
ifnotapi.send_verification_code(device):
print("Failed to send verification code")
sys.exit(1)
code=click.prompt('Please enter validation code')
ifnotapi.validate_verification_code(device, code):
print("Failed to verify verification code")
sys.exit(1)
start_date=datetime.now()
end_date=start_date+timedelta(hours=2)
events=api.calendar.events(from_dt=start_date, to_dt=end_date)
print(events)
I don't have an apple device, had one and with that id and password i'm working, so I'm using two step authentication in order to receive an SMS in my non apple phone.
I receive my SMS and I introduce the code number well but then it says me Failed to verify verification code.
When I run the script for the second time with the same apple'id and password it throws me the error logs attached in this description, not authenticated ( ref: Traceback/Error logs)
Then I realized that my account is locked and api.requires_2sa is set to False, so I need to go to https://appleid.apple.com/ and change my apple id's password.
Changed my apple id's password and api.requires_2sa is set to True again, run the script and it says me Failed to verify verification code once again.
My question are:
do I need to have an apple device in order to do this and try with two step authentication? (I think two factor authentication is not working)
Why api.requires_2sa is set to True the first time and when you fail is set to False ?
Environment
pyiCloud release with the issue (pip show pyicloud): 1.0.0
Traceback (most recent call last):
File "/home/juanfran/tucalendi_api_arch/app/app/integrations/apple/icloud.py", line 70, in <module>
events = api.calendar.events(from_dt = start_date, to_dt = end_date)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/pyicloud/services/calendar.py", line 64, in events
self.refresh_client(from_dt, to_dt)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/pyicloud/services/calendar.py", line 57, in refresh_client
req = self.session.get(self._calendar_refresh_url, params=params)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/pyicloud/base.py", line 131, in request
return self.request(method, url, **kwargs)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/pyicloud/base.py", line 133, in request
self._raise_error(response.status_code, response.reason)
File "/home/juanfran/tucalendi_api_arch/venv/lib/python3.9/site-packages/pyicloud/base.py", line 189, in _raise_error
raise api_error
pyicloud.exceptions.PyiCloudAPIResponseException: Authentication required for Account. (421)
Checklist
[X ] I've looked informations into the README.
[ X] I've looked informations into the pyiCloud's code.
[ X] I've looked informations in Google.
Additional information
The text was updated successfully, but these errors were encountered:
The problem
Hello, I'm using this script in order to get my calendar events:
Failed to verify verification code
.api.requires_2sa
is set toFalse
, so I need to go to https://appleid.apple.com/ and change my apple id's password.api.requires_2sa
is set toTrue
again, run the script and it says meFailed to verify verification code
once again.My question are:
api.requires_2sa
is set toTrue
the first time and when you fail is set toFalse
?Environment
pip show pyicloud
): 1.0.0python -V
): Python 3.9.6Distributor ID: Debian
Description: Debian GNU/Linux 9.13 (stretch)
Release: 9.13
Codename: stretch
Traceback/Error logs
Checklist
Additional information
The text was updated successfully, but these errors were encountered: