def replace_period(old_period_id, new_period_data): """Replace a period with new data""" # Delete old requests.delete( f"https://api.dcycle.io/v1/employee-historic/{old_period_id}", headers=headers ) # Create new response = requests.post( "https://api.dcycle.io/v1/employee-historic", headers=headers, json=new_period_data ) return response.json()