- import requests
- # Login details
- username = "Grace+Redding"
- password = "Beckett1234"
- # Login URL and payload
- url = "http://www.waitroseconnect.co.uk/names.nsf"
- payload = {
- "RedirectTo": "/waitroseconnect/menu.nsf",
- "DBPath": "domcfg.nsf",
- "Server_Name": "www.waitroseconnect.co.uk",
- "Username": username,
- "Password": password
- }
- # Headers
- headers = {
- "Content-Type": "text/html"
- }
- # Send login request
- response = requests.post(url, data=payload, headers=headers)
- # Check if login was successful
- if response.status_code == 200:
- # Extract session cookies from the response
- session_cookies = response.cookies
- # Use the session cookies in subsequent requests
- headers_with_cookies = headers.copy()
- headers_with_cookies["Cookie"] = "; ".join([f"{cookie.name}={cookie.value}" for cookie in session_cookies])
- # Example: Access a protected resource
- protected_resource_url = "http://www.waitroseconnect.co.uk/waitroseconnect/menu.nsf"
- protected_response = requests.get(protected_resource_url, headers=headers_with_cookies)
- # Process the response
- print(protected_response.text)
- else:
- print("Login failed:", response.status_code)
[text] Z
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: