add print statement immediately after line 168:
print('response.status_code: {}'.format(response.status_code))then change line 169 to:
if response.status_code != 200:I'm almost certain that that code is an integer, and you're trying to match string