I opened up Python consoles on both PythonAnywhere and my local machine and ran the following:
payload = {'action':'browsebysubject', 'subject':'Property:Dairy_or_meat', 'format':'json'}
req = requests.post('http://mikomos.com/w/api.php', data=payload)
On PythonAnywhere req.text
outputs:
'<HTML>\n <HEAD>\n Access Denied\n </HEAD>\n<BODY>\n\n<h1>Access Denied</h1>\n\n<p>\nAccess to arbitrary websites is not available from free accounts;\nyou can only access sites that are on our\n<a href="http://www.pythonanywhere.com/whitelist">whitelist</a>.\nIf you want to suggest something to add to our whitelist\ndrop us a line at support@pythonanywhere.com. It will have\nto have an official public API.\n</p>\n\n\n<p>\nAlternatively, you can sign up for a paid account at\n<a href="http://www.pythonanywhere.com/account/">http://www.pythonanywhere.com/account/</a>\n</p>\n<p>\nIf you have already got a paid account and you\'re still getting this messge,\nyou may need to reload your web app (from the "Web" tab) or restart\nyour consoles. If that doesn\'t help, drop us a line at support@pythonanywhere.com.\n</p>\n\n</BODY>'
On my local machine, however, the output is what I expect:
'{"query":{"subject":"Dairy_or_meat#102#","data":[{"property":"_MDAT","dataitem":[{"type":6,"item":"1/2013/8/4/21/23/4"}]},{"property":"_PVAL","dataitem":[{"type":2,"item":"Dairy"},{"type":2,"item":"Pareve"},{"type":2,"item":"Meat"}]},{"property":"_SKEY","dataitem":[{"type":2,"item":"Dairy or meat"}]},{"property":"_TYPE","dataitem":[{"type":5,"item":"http://semantic-mediawiki.org/swivt/1.0#_txt"}]}],"serializer":"SMW\\\\Serializers\\\\SemanticDataSerializer","version":0.1}}'
Any other ideas? Thank you!