- import requests
- # URLs for various actions
- select_options_url = 'https://toolkit.tesco.com/partner/reports/'
- save_options_url = 'https://toolkit.tesco.com/partner/reports/'
- download_report_url = 'https://toolkit.tesco.com/partner/reports/'
- # Define options for each category/subcategory
- Country = ['UK', 'ROI']
- Report type = ['Sales and stock', 'Range conformance', 'Promotional funding', 'Auto sales out retro deals', 'Fulfilment fee', 'Performance summary', 'Cost price amendments', 'Purchase order amendments']
- Product subgroup = ['All product subgroups']
- products = ['All products']
- View = ['TPNB – Total sales', 'TPNB – Sales x store', 'TPNB – Sales x store format', 'TPNB - Sales x DC','Product subgroup - Total sales','Stores - Total sales','Store Format - Total sales']
- time_periods = ['Last full week (Wk 08']
- # Iterate over combinations of options
- for country in Country:
- for Report_type in Report type:
- for product in products:
- for view in View:
- for time_period in time_periods:
- # Send request to select options
- options_data = {
- 'Country': country,
- 'Report type': Report_type,
- 'product': product,
- 'view': view,
- 'time_period': time_period
- }
- response_options = requests.post(select_options_url, data=options_data)
- # Check response if needed
- # Simulate saving options (if applicable)
- save_options_data = {'save_option1': True, 'save_option2': False}
- response_save_options = requests.post(save_options_url, data=save_options_data)
- # Check response if needed
- # Simulate clicking "Download Report" button
- response_download = requests.get(download_report_url)
- # Check if download request was successful
- if response_download.status_code == 200:
- # Process the downloaded report file if needed
- with open('report.csv', 'wb') as f:
- f.write(response_download.content)
- print("Report downloaded successfully.")
- else:
- print("Failed to download report. Status code:", response_download.status_code)
[text] g
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: