- import requests
- from bs4 import BeautifulSoup
- def authenticate(username, password):
- # URL for login
- login_url = f"http://www.waitroseconnect.co.uk/waitroseconnect/menu.nsf/Login?OpenAgent&Username={username}&Password={password}"
- # Construct the URL for further requests (modify as needed)
- url = f"http://www.waitroseconnect.co.uk/waitroseconnect/reference/WaitroseConnectSalesV2.nsf/WeeklyDataDocsViewForm?OpenForm"
- # Send a get request to authenticate
- session = requests.Session()
- try:
- response = session.get(login_url)
- response.raise_for_status() # Raise an error for bad status codes
- print("Authentication successful!")
- # Send another get request for further operations
- response = session.get(url)
- response.raise_for_status()
- # Parse the HTML content
- html_content = response.text
- soup = BeautifulSoup(html_content, 'html.parser')
- text_content = soup.get_text()
- print(text_content)
- except requests.exceptions.RequestException as e:
- print("Error:", e)
- except Exception as e:
- print("An unexpected error occurred:", e)
- # Example usage:
- username = input("Enter your username: ")
- password = input("Enter your password: ")
- authenticate(username, password)
[text] A
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: