Whenever necessary to make an inspection to enforce any of the provisions of this Code, or whenever the building official has reasonable cause to believe that there exists in any building or upon any premises any condition or code violation which makes such building or premises, plumbing, mechanical or gas systems unsafe, dangerous or hazardous, the building official (may enter such building or premises at all reasonable times to inspect the same or to perform any duty imposed upon the building official) by this Code, provided that if such building or premises is occupied, he shall first present proper credentials and request entry. If such building or premises is unoccupied, he shall first make a reasonable effort to locate the owner or other persons having charge or control of the building or premises and request entry. If such entry is refused, the building official shall obtain a property inspection warrant or other remedy provided by law.