Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
python_wiki:exceptions [2017/09/17 00:14] billdozor [Exceptions] |
python_wiki:exceptions [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 54: | Line 54: | ||
exit(1) | exit(1) | ||
</ | </ | ||
+ | |||
+ | \\ | ||
+ | Another example is using a try, except when using an API for logins. | ||
+ | <code python> | ||
+ | # Attempt to login and get a session id | ||
+ | try: | ||
+ | key = server.auth.login(spacewalk_login, | ||
+ | except: | ||
+ | print(" | ||
+ | exit(1) | ||
+ | </ | ||
+ | * NOTE: The above code will not run by itself, as it is a snippet from using a Spacewalk API. | ||
---- | ---- | ||