lv
Utils to slurp stuff
To install: pip install lv
Overview
The lv package provides utilities to automate web interactions, particularly for logging into websites and downloading content. The primary functionality is encapsulated in the slurp_with_login_and_pwd function. This function uses the mechanize library to handle web requests, manage cookies, and parse forms, allowing users to log into sites and access resources that require authentication.
Functionality
slurp_with_login_and_pwd
This function automates the process of:
- Opening a web page with a login form (currently hardcoded to Yahoo's login page).
- Filling out and submitting the login form with user credentials.
- Navigating to a subsequent URL (currently hardcoded to a specific Coursera lecture video) after logging in.
- Downloading content from the final URL.
The function uses mechanize.Browser to simulate a web browser, which handles cookies and user-agent headers to maintain session and appear as a regular browser to web services.
Usage
Basic Example
Below is an example of how you might use the slurp_with_login_and_pwd function within a Python script. Note that you will need to replace 'yahoo-user-id' and 'password' with your actual Yahoo credentials, and the URL with the resource you wish to access after logging in.
from lv import slurp_with_login_and_pwd
# Ensure you replace the credentials and URL with your specific details
slurp_with_login_and_pwd()
Important Notes
- The function is currently tailored specifically for Yahoo and a Coursera course video. To use it for other websites or resources, modifications to the function are required.
- Ensure that your use of this function complies with the terms of service of the website you are interacting with.
Dependencies
mechanize: Used for handling HTTP requests, forms, cookies, and more.
Installation
To use the lv package, you will need to install the required dependencies:
pip install mechanize
Then, you can install the lv package itself:
pip install lv
Disclaimer
This tool is intended for educational and legitimate purposes only. Ensure that you have the right to access and download content from the website, and always respect the terms of service of the website.
Metadata
Release files for lv 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lv-0.0.7.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lv-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / lv-0.0.7.tar.gz
| Download URL | lv-0.0.7.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7563c0eabe5ed804c13d078c434063ce59ae261247c1f3217c02d6fac91adab
|
|
BLAKE2b-256 checksum How to use checksums |
013ae2dbdf8593629effebb01ffa7a5ba2e76bea0f7d4d4b45b9289fb81ede08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / lv-0.0.7-py3-none-any.whl
| Download URL | lv-0.0.7-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceaa6ba49e5b33d1d7d417491002b90711c2f40d4c82f5127f04655fda8135e1
|
|
BLAKE2b-256 checksum How to use checksums |
bca8f843db060e8a40b9f8e0d1f8a19d0ce0e37e06b8aad4f60c85153e9ae4cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|