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
- Authenticated 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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca989bd9f158e7ca0522d5a4907b3fdb280ec9e48ab682b13478416728bf91f8 |
|
MD5 | 07d609e0e4dc39b7f3895d89d58583fc |
|
BLAKE2b-256 | 8d8ca252e0f999cfdf6a1edc18d4082533ec3bd0526c7ca4f1c12bb0e469a546 |
Hashes for city_of_saskatoon_auth-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 273727afcacbade19cb92219dbca9cc1eacc2a2efec6547410cc65ac59f1706d |
|
MD5 | aec4d498fff8e00f436ca308645dd0f1 |
|
BLAKE2b-256 | dbe014e8076ecf8658b4206d5094f4eb3e062b2404709d27e919b339d6147a51 |