Forums

Getting response 301 for send_input

I am trying to use python anywhere api: username = rahbar11 token = my_token headers = {'Authorization': f'Token {token}'} I'd = my_console_id url = f"http://www.pythonanywhere.com/api/v0/user/{username}/consoles/{id}/send_input/?input=ls" Res = requests.post(url, headers=headers)

I'm getting a response of method get not allowed even when I'm doing post request. I tried allow_redirects=False I'm getting response of 301 by this. Tried using json, params, using content-type: application/json but no luck

instead of ?input=ls in the url add json={"input": "ls\n"} to your post