[text] N

Viewer

  1. import requests
  2.  
  3. # Login details
  4. username = "Grace+Redding"
  5. password = "Beckett1234"
  6.  
  7. # Login URL and payload
  8. url = "http://www.waitroseconnect.co.uk/waitroseconnect/menu.nsf/Login?OpenAgent"
  9. payload = {
  10.     "Username": username,
  11.     "Password": password
  12. }
  13.  
  14. # Headers
  15. headers = {
  16.     "Content-Type": "application/x-www-form-urlencoded"
  17. }
  18.  
  19. # Send login request
  20. response = requests.post(url, data=payload, headers=headers)
  21.  
  22. # Check if login was successful
  23. if response.status_code == 200:
  24.     # Print response headers
  25.     print("Response Headers:")
  26.     print(response.headers)
  27.  
  28.     # Example: Access a protected resource
  29.     protected_resource_url = "http://www.waitroseconnect.co.uk/waitroseconnect/menu.nsf"
  30.     protected_response = requests.get(protected_resource_url)
  31.  
  32.     # Process the response
  33.     print(protected_response.text)
  34. else:
  35.     print("Login failed:", response.status_code)

Editor

You can edit this paste and save as new:


File Description
  • N
  • Paste Code
  • 06 May-2024
  • 920 Bytes
You can Share it: