Forums

501 Server Error: Not Implemented

Hey guys, anyone facing this issue? I have a Python script scheduled to run daily and it worked fine before. Using Requests and Firebase libraries - stack trace is below. Any idea what it could be? Thanks!

Traceback (most recent call last):
  File "backup_trackerati_firebase.py", line 58, in <module>
    data = json.dumps(f.get('/', None), sort_keys = False, indent = 4)
  File "/home/thehackerati/.local/lib/python2.7/site-packages/firebase/decorators.py", line 19, in wrapped
    return f(*args, **kwargs)
  File "/home/thehackerati/.local/lib/python2.7/site-packages/firebase/firebase.py", line 274, in get
    return make_get_request(endpoint, params, headers, connection=connection)
  File "/home/thehackerati/.local/lib/python2.7/site-packages/firebase/decorators.py", line 19, in wrapped
    return f(*args, **kwargs)
  File "/home/thehackerati/.local/lib/python2.7/site-packages/firebase/firebase.py", line 42, in make_get_request
    response.raise_for_status()
  File "/home/thehackerati/.local/lib/python2.7/site-packages/requests/models.py", line 638, in raise_for_status
    raise http_error
requests.exceptions.HTTPError: 501 Server Error: Not Implemented

2015-03-13 20:42:12 -- Completed task, took 4.00 seconds, return code was 1.

That probably means that you're trying to use a request method for the URL that is not supported. For instance, if the URL only accepts GET requests and you try to POST to it.

But this exact code works from my laptop, and it worked on this server before!

Are you sure you're using exactly the same parameters, method and URL from your laptop? That error is coming from the other end of the connection -- from the server you're connecting to -- so it would be really weird if they sent back a different response depending on where you're accessing it from.

I am absolutely sure. I have even reinstalled packages in use on both machines and it works fine on my comp. but I am getting abovementioned error here If Firebase has blocked this site, would this be the error that comes up?

It might be, though it would be odd (I'd expect a 403 Forbidden). Can you find out the exact URL/method/data you're sending? You can send it to us via the "Send feedback" option if it's got private stuff in it that you don't want to share on the forums.

Here is a question i posted on SO, if you need any more info, please let me know. http://stackoverflow.com/questions/29108093/getting-501-server-error-not-implemented-error-when-trying-to-backup-firebase-f

Another experiment- what happens if you try to access firebase in any other way?

Everything else works fine to the best of my knowledge.

So other calls to firebase on PythonAnywhere also work?

I thought you meant accessing it from other places - no problems there. That call is the only call to Firebase that is made from PythonEverywhere. It's basically a script that backs it up. So I cannot confirm that it works from PythonEverywhere at all.

Right. Maybe it would be useful to try calling firebase from commandline/the python repl and seeing if other firebase calls fail, and seeing what errors it is giving?

not sure what you mean

It looks like Firebase is authenticating correctly - but any firebase.get() call throws that error. This is so weird!

hmm - can you confirm if you can curl the url you are trying to access? Or is it blocked? If it is blocked you will have to get us to put it onto the whitelist for you. If you look at our list of whitelisted sites, We already have .firebase.com, .firebaseio-demo.com, and .firebaseio.com whitelisted. But maybe you are trying to accessing something else?

Yeah, I can curl it... Some black magic