Can I still masturbate?

So I was in preterm labor a month ago. It was minor and happened bc of an infection that has been cleared.

My question is, can I masturbate and still be ok? pregnancy makes you horny.

PS- My doctor didn't say avoid sexual activity. I also don't want to ask my doctor because it's awkward and it's not a female doctor.