Skip to main content

CASPass - Login through Central Authentification Systems

Project description

CASPass - Login through Central Authentification Systems

Motivation

When you write a web scraper, Central Authentification Systems are often difficult to get through. Most of them use a lot of Javascript and protection mechanisms, so it's complex to automate. Moreover, you need to understand a completely different logic, which is useless with respect to the website you want to scrap.

The chosen approach for CASPass is to avoid completely to understand the CAS logic and to rely on a full browser, namely Playwright, to authenticate. This a semi-automatic process since you need to manually enter your credentials, on the login page you are used to work with. But it's only needed one time, CASPass save all the cookies into a file which can be used by a traditional scrapper library (like requests or httpx).

Obviously this semi-automatic approach is not usable in a fully non-interactive context, like a CI/CD system. However, it has many advantages:

  • no need to understand the CAS,
  • no need to bother with Captcha,
  • no complex logic to understand,
  • moreover, most of the authentication tokens stored in cookies have a pretty long duration, so you will only have to manually log in from time to time.

CASPass works also without a CAS: when the login process is full of Javascript, Captcha or other security checks and too complex to automate, just use this module to authenticate and then perform the scraping with a more efficient tool.

Installation

pip install python-caspass

or

pip install git+https://codeberg.org/oschwand/python-caspass

Usage

The CASPass constructor expects two arguments:

  • a list of URL leading to the login page (you may need to provide multiple links in order to satisfy the security checks)
  • the success URL, reached after successful login (it indicates the login process is terminated)
from caspass import CASPass

cas = CASPass([url, url_login], url_success)
cas.login()
cas.save("cookies.txt")

See examples/ for some complete examples.

Licence

GPLv3+

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

python_caspass-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_caspass-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file python_caspass-0.1.2.tar.gz.

File metadata

  • Download URL: python_caspass-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/6.1.0-17-amd64

File hashes

Hashes for python_caspass-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5e9518d2bd807f141134461528a6821be38b4e0ec503802d0e547d2d6a753ad0
MD5 cb005a688c95ad1596739a8b9bb9a6b8
BLAKE2b-256 7ed3c4e1de1bdf947cef3b10f5c534dcc8ccd9d10279662535ebeffd2257ed92

See more details on using hashes here.

File details

Details for the file python_caspass-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_caspass-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.2 Linux/6.1.0-17-amd64

File hashes

Hashes for python_caspass-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3499dfd8e206638bc91a695747bc8d2ec41ff34cf923928aaf0bd065ebc3c543
MD5 0b6328a95d04d4fd64eba42ef609c102
BLAKE2b-256 6c53bd9967ac436a8f9d28db120917b9b1500bee8f5a7f1d95f880d3ad8d754e

See more details on using hashes here.

Supported by

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