Preheat the oven to 180°C/fan 160°C/gas mark 4. Rub the oil all over the chicken and season well. Cut the lemon in half, cut the onion into wedges and strip the rosemary leaves from their stalk, then stuff it all inside the chicken.
Place into a deep flameproof roasting tin and surround with the shallots. Pour in 375ml prosecco, cover tightly with foil and roast for 1 hour 15 minutes.
Remove the foil and increase the heat to 200°C/fan 180°C/gas mark 6. Cook for another half hour until the skin is golden and crispy, and the juices run clear.
Carefully transfer the chicken to a serving dish or board, and cover with foil to rest. You can pour the juices into a saucepan, or leave them in the tin if the prosecco hasn’t darkened too much. Stir the flour into the juices and shallots over a low heat on the hob until a paste forms. Increase the heat, then pour in the stock, little by little, stirring all the time, until a gravy forms. Stir in the remaining prosecco and bubble for a minute or two, until well combined. Serve the carved chicken with the prosecco gravy.