# To find your webflow login cookies :
# 1 - Go to your Webflow dashboard
# 2 - Press F12, click on the network tab
# 3 - Click on any tab
# 4 - Copy as cUrl the first request to webflow.com/api and paste it at https://curl.trillworks.com/ to get your login cookies in Python in the "cookies" variable

cookies = YOUR_WEBFLOW_LOGIN_COOKIES
project_name = "quable"

def addWebflowRedirect(oldPath,newPath):
    headers = {
    'Connection': 'keep-alive',
    'Accept': 'application/json, text/plain, */*',
    'X-XSRF-Token': 'UcJjCY7A-eQsFuSbp4QDuRU7-466hSyptGjo',
    'X-Requested-With': 'XMLHttpRequest',
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36',
    'Content-Type': 'application/json;charset=UTF-8',
    'Origin': 'https://webflow.com',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': f'https://webflow.com/dashboard/sites/{project_name}/hosting',
    'Accept-Language': 'en-US,en;q=0.9,fr;q=0.8'}
    data = json.dumps({"path":oldPath,"targetPath":newPath})

    response = requests.post(f'https://webflow.com/api/sites/{project_name}/hosting', headers=headers, cookies=cookies, data=data)
    return response.json()