- import requests
- # Authentication URL for the Tesco Portal API
- auth_url = "https://toolkit.tesco.com/api/login"
- # URL to fetch the JSON response containing report details
- url = "https://toolkit.tesco.com/partner/reports/api/v1/generated-reports-v2"
- payload = {
- "pageNumber": 0,
- "pageSize": 10
- }
- # Username and password for authentication
- username = "georgina.keyes@pladisglobal.com"
- password = "Pladmarch11"
- # Authentication request data
- data = {
- "username": username,
- "password": password
- }
- # Create a session object
- session = requests.Session()
- # Authenticate and receive cookies
- auth_response = session.post(auth_url, json=data)
- # Check if authentication was successful
- if auth_response.status_code == 200:
- print("Authentication successful!")
- # Fetch JSON response containing report details using the session object
- response_reports = session.get(url, params=payload)
- # Check if fetching JSON response was successful
- if response_reports.status_code == 200:
- # Process the JSON response
- reports_data = response_reports.json()
- print("Report details:", reports_data)
- else:
- print("Failed to fetch report details JSON response:", response_reports.status_code, response_reports.text)
- else:
- print("Authentication failed. Please check your credentials.")
[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: