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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 669e5d817a556d3ea113a4963ae41522133f70af259da1638684850ed32642ba |
|
MD5 | ce7db94132d3236243233aed1a138ab8 |
|
BLAKE2b-256 | 5324571f6271a2ec8ad30807df13a5d1ec579850dea9767e70130508b2f92f97 |
Hashes for city_of_saskatoon_auth-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dbc5836ebec1f4dbd885106904b0acf285f3e92a673e87746bd7a55388a4262 |
|
MD5 | 201882afe48b66ef5bf884b9a88c0519 |
|
BLAKE2b-256 | 5ef3e94a2261c360fee450c809ab653f6c5049d064b0852621904c1c290e72e5 |