In one narration the words are: "Indeed, Allah Almighty has purified this town of shirk (associating partners with Allah), so long as the stars (or astrology) do not lead them astray."
Abu Ya'la recorded it, and al-Tabarani in al-Mu'jam al-Kabir and al-Mu'jam al-Awsat. Its chain contains Qays bin al-Rabi', whom Shu'bah and al-Thawri declared thiqah (trustworthy), while (other) people declared him da'if (weak); the remaining narrators of this report are thiqat (trustworthy).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الطب / 8476