- import requests
- import json
- # Authentication URL for the Tesco Portal API
- auth_url = "https://toolkit.tesco.com/partner/reports/api/v1/authenticate"
- # URL to fetch the JSON response containing report details
- url = "https://toolkit.tesco.com/partner/reports/api/v1/generated-reports-v2"
- # Username and password for authentication
- username = "your_username"
- password = "your_password"
- # 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.post(url)
- # 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.")
- else:
- print("Authentication failed. Please check your credentials.")
[text] J
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: