0

Trying to make a request from web App on Pythonanywhere (paid account) with a Flask. This works as needed on local PC, but receives an error on Pythonanywhere.

@app.route('/test/')
def test():
 url_cookies='https://www.phoenixcontact.com/online/portal/ru/pxc/offcontext/'
 headers = {'authority': 'www.phoenixcontact.com',  'method': 'GET','user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
 requestCookies = requests.get(url_cookies,headers=headers)
 return 'Test'+requestCookies.text
2
  • What's the error that you're getting? Your call to requests.get will return a response object. You're calling that requestCookies, so it would be useful to know the values of requestCookies.status_code and requestCookies.content. Commented Jun 28, 2018 at 11:39
  • I got 504 error, and it seems like the site I trying to request just blocking any activity from pythonanywhere. Commented Jun 29, 2018 at 12:14

1 Answer 1

1

pythonanywhere has a only allowed limited webpages to be scrapped with the free version. You can remove this restriction by upgrading to one of their premium plans.

You might consider using FreeHosts like OpenShift for hosting your app.

Sign up to request clarification or add additional context in comments.

2 Comments

Don't think that's the issue here -- the poster says that he has a paid account.
Sorry, I noticed that after answering the question. But didn't delete the answer as I thought that it might be informative to others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.