abertschi / postcard_creator_wrapper

A python wrapper around the Rest API of the Swiss Postcard creator :postbox:
https://abertschi.ch/blog/2022/receiving-postcards/
Apache License 2.0
52 stars 10 forks source link

Swissid login failed #45

Closed sgenoud closed 1 year ago

sgenoud commented 1 year ago

I have the following error:

Traceback (most recent call last):
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/bin/postcards-folder", line 8, in <module>
    sys.exit(main())
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcards/plugin_folder/postcards_folder.py", line 134, in main
    PostcardsFolder().main(sys.argv[1:])
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcards/postcards.py", line 55, in main
    self.do_command_send(args)
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcards/postcards.py", line 104, in do_command_send
    wrappers, try_again_after = self._create_pcc_wrappers(accounts,
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcards/postcards.py", line 178, in _create_pcc_wrappers
    if token.has_valid_credentials(account.get('username'), account.get('password')):
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcard_creator/token.py", line 84, in has_valid_credentials
    self.fetch_token(username, password, method=method)
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcard_creator/token.py", line 129, in fetch_token
    raise e
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcard_creator/token.py", line 123, in fetch_token
    access_token = self._get_access_token_swissid(session, username, password)
  File "/Users/stevegenoud/.virtualenvs/postcards-oUvzP0s_/lib/python3.9/site-packages/postcard_creator/token.py", line 357, in _get_access_token_swissid
    url = step7_soup.find('form', {'name': 'LoginForm'})['action']
TypeError: 'NoneType' object is not subscriptable

I guess that they changed their login page and it broke the login flow you implemented.

P.S. Thanks for the great tool, I use it for a small project for a friend's wedding. People uploaded photos of the wedding day and I send them as a postcard twice a week!

sgenoud commented 1 year ago

It must have been a temporary hiccup on the server side - it works now.

Thanks for the tool anyway!

abertschi commented 1 year ago

ok, im glad you like it! cheers

Roilek commented 1 year ago

Same issue here, not fixed for now, will see if evolves

abertschi commented 1 year ago

Just checked the endpoint, works just fine.

Roilek commented 1 year ago

All good now, had problems with post and swissid, sorry for disturbing!