I think using requests would make this more compact. Also, I think I'm repeating myself. Will stop now.