abertschi / postcards

A CLI for the Swiss Postcard Creator :postbox:
https://abertschi.ch/blog/2022/receiving-postcards/
MIT License
36 stars 8 forks source link

--message flag not properly parsed #41

Closed jorisnoo closed 3 years ago

jorisnoo commented 4 years ago

Thanks a lot for your work, @abertschi!

I gave it a try and ran the example code: postcards send --config config.json --picture https://images.pexels.com/photos/365434/pexels-photo-365434.jpeg --message "Happy coding" --mock --key

It worked fine — however, the postcard apparently got sent, despite setting the --mock flag (since shortly after I received a confirmation via email and the account was not valid for the next 24h).

Did I do anything wrong or has something changed that made the mock flag being ignored? Or was the card not actually sent?

abertschi commented 4 years ago

mock does not call the last endpoint in all the endpoints required to submit a card. The card still is uploaded to the vendor. This is primarily meant for development and testing purposes. It could be that the vendor changed the steps required to submit a card and the last endpoint is obsolete. I am not aware of this, however. If you further want to investigate this, you can increase log verbosity and ensure that you can reproduce the behavior.

jorisnoo commented 4 years ago

The message that got printed on the card was Happy coding --mock, so I assume the issue was the flag not being passed properly, and the issue may probably be closed. Thanks!

abertschi commented 4 years ago

Just verified what you wrote. This is indeed an issue. If more arguments are passed --after-- --message they are not properly parsed and are all added to the argument of message.

$ postcards-pexels -vvvv send -c config.json --mock --message "test"  

postcards_pexel (TRACE): Namespace(accounts_file=False, all_accounts=False, config_file=['config.json'], key=(None,), message=['test'], mock=True, mode='send', password='', picture=None, test_plugin=False, username='', verbose_count=4)
$ postcards-pexels -vvvv send -c config.json --message "test" --mock    

postcards_pexel (TRACE): Namespace(accounts_file=False, all_accounts=False, config_file=['config.json'], key=(None,), message=['test', '--mock'], mock=False, mode='send', password='', picture=None, test_plugin=False, username='', verbose_count=4)
abertschi commented 3 years ago

ffe3de2a089ca55f28c6e41329a5c15c674afe23