It is lawful for any revenue officer or constable to enter and remain so long as may be necessary upon any lands or premises other than a dwelling house for the purpose of demanding and requiring the production of any licence under either of the 2 last preceding sections.