Skip to main content

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:

  1. Authenticates with both the main City of Saskatoon website/user portal
  2. Authenticates with the My SmartUTIL tool
  3. Provides a requests.session object that allows you to make authenticated requests
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

city_of_saskatoon_auth-0.0.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

city_of_saskatoon_auth-0.0.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file city_of_saskatoon_auth-0.0.3.tar.gz.

File metadata

File hashes

Hashes for city_of_saskatoon_auth-0.0.3.tar.gz
Algorithm Hash digest
SHA256 669e5d817a556d3ea113a4963ae41522133f70af259da1638684850ed32642ba
MD5 ce7db94132d3236243233aed1a138ab8
BLAKE2b-256 5324571f6271a2ec8ad30807df13a5d1ec579850dea9767e70130508b2f92f97

See more details on using hashes here.

File details

Details for the file city_of_saskatoon_auth-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for city_of_saskatoon_auth-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3dbc5836ebec1f4dbd885106904b0acf285f3e92a673e87746bd7a55388a4262
MD5 201882afe48b66ef5bf884b9a88c0519
BLAKE2b-256 5ef3e94a2261c360fee450c809ab653f6c5049d064b0852621904c1c290e72e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page