Sleeping pills! 💊💤

Can someone please tell me the process of getting sleeping pills? 
Like do doctors go through lots of tests before giving you them or no? 
I'm 17 and I have trouble falling asleep and staying asleep almost every night. Only time I have no problem falling asleep is when I've been drinking or smoking(weed) 
I seriously feel like this is my last resort, I've tried sleeping stuff and nothing helped x