Could I be pregnant?

So I recently had a baby on 12/5 the dr said to wait to have sex until 01/31 but you know things happen and I didn’t wait. Me and my bf we’re having sex in the shower and he’s not 100 sure if he pulled out in time 🤦🏽‍♀️ I know it was a bad choice not to wait and should have used a condom but it’s already done. I’m still having a little spotting due to the post-partum delivery. Should I buy a pregnancy test and how soon can I test, or since I’m spotting I’m fine. Any advice would be helpful and please don’t judge just looking for opinions.