An unofficial Python module for authenticating with the City of Saskatoon website
Project description
city-of-saskatoon-auth
An unofficial Python module for authenticating with the City of Saskatoon website.
Features:
- Authenticates with both the main City of Saskatoon website/user portal
- Authenticates with the My SmartUTIL tool
- Provides a
requests.session
object that allows you to make authenticated requests - Allows saving and restoring your session for later use
Usage
from city_of_saskatoon_auth import session
s = session.Session('username', 'password')
s.login() # Log in to main City of Saskatoon portal
s.smart_util_login() # OPTIONAL: Log in to the My SmartUTIL portal
# You are now authenticated with the City of Saskatoon website, and can make authenticated requests.
# s.get() and s.post() are available, and use the same API as the requests library
s.get('URL')
s.post('URL', data={}, headers={})
Saving and restoring your session
Your session can be written to a byte string that can either be saved to a file any other storage. It can then be later restored to make requests without logging in again.
WARNING: This archive contains your username and password, and is NOT secure. Be careful where you store it.
from city_of_saskatoon_auth import session
s = session.Session('username', 'password')
s.login() # Log in to main City of Saskatoon portal
saved_session = s.to_archive()
s2 = session.Session.from_archive(saved_session)
s2.login() # Checks if the session is still valid, and logs in again if not
NOTE: Even though your main City of Saskatoon session was restored, you'll need to call s.smart_util_login()
for every new session. This ensures you're getting the most up-to-date data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for city_of_saskatoon_auth-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4a19fd9f69df7d5b56660d55de4fe31851bb0034d905d0c2fc07edc1d9d2f8 |
|
MD5 | 7c97a6254f3b09403af3a7db1af365e6 |
|
BLAKE2b-256 | 3f9fca06d4f0059fdaa2b1c72a22f58407a7ebefa469eb63ffd6fa4ff21f986c |
Hashes for city_of_saskatoon_auth-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 657ac75783c9884835ae870d54c523b3ca0ad528820162cd7bdb05b10edc94e3 |
|
MD5 | 903a3983135c3364a3546e9b51400899 |
|
BLAKE2b-256 | 6512a631a0cef5b7ea595424efb1fcd03499ee165b3b1efc5983c1a1cd7e7777 |