I am trying to figure this out, but had no luck:
import requests
r = requests.get(\'http://example.com/m7ppct4\', allow_redirects=True)
import requests
import json
import pprint
r = requests.get('URL')
pprint.pprint(json.loads(r.content))
You must send any user agent:
import requests
r = requests.get('http://example.com/m7ppct4', headers={'User-Agent':'test'})
It looks like the website linked by tinyurl (azstatejobs) filters requests based on user-agents. Spoofing the Chrome user-agent worked for me:
import requests
url = 'http://tinyurl.com/m7ppct4'
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36'
headers = {'User-Agent': user_agent}
r = requests.get(url, headers=headers)
(allow_redirect
is true by default)
You might want to try different user-agents and see what makes that website not like the python requests user-agent.