It seems like i am hitting some race condition in between the time I stop my server and during that I make request through tornado proxy frontend.
I get very famous error
WARNING:tornado.access:404 POST /request-url/eff74/36eb5e9f-def1-4689-ad58-3bf866798864/client-update (::1) 0.88ms
ERROR:tornado.general:Cannot send error response after headers written
WARNING:tornado.access:404 POST /request-url/eff74/36eb5e9f-def1-4689-ad58-3bf866798864/client-update (::1) 1.36ms
ERROR:tornado.general:Cannot send error response after headers written
WARNING:tornado.access:404 POST /request-url/eff74/36eb5e9f-def1-4689-
which is described in source code here
Can I resolve this problem?
Point of confusion is I am getting 404 already, then why I am getting an error after wards.
Cheers
Actually, it was very silly bug in my code.
Bug was the proxy function which was handling "requests" wasn't issuing "return" statement from the function.
Example:
def proxy_handler(self, request, response):
# some task
response.set_status(status_code)
response.send("status_code: message")
return # this was missing earlier
So tornado was trying to send respons which already has been sent. Thus getting the error
WARNING:tornado.access:404 POST /request-url/eff74/36eb5e9f-def1-4689-ad58-3bf866798864/client-update (::1) 1.36ms
ERROR:tornado.general:Cannot send error response after headers written
Cheers
Related
I am using webhooks to try and get a response from my texts using Twilio. However, I am getting a 403 forbidden error when I send a message to the server, and of course not getting a response as a result. My firewall is turned off on my Mac so I know it's not that blocking it.
Here are some more details from ngrok:
Content-type: application/x-www-form-urlencoded
I-Twilio-Idempotency-Token: f44545da-e917-46e6-b24b-e9bf6f727a49
X-Forwarded-For: 3.93.218.220
X-Twilio-Signature: F5mURKfEP6sM/DMGiOFcYPD7lKo=
Host: 843e-167-98-155-255.eu.ngrok.io
User-Agent: TwilioProxy/1.1
Acceptance encoding: gzip
X-forwarded protocol: https
Let me know if any other details are required- I couldn't get logs from ngrok.
I found a similar post, but I checked and my firewall is NOT turned on: How to fix 403 error what Twilio calls my webhook?
I am using Python with Jupyter Notebook.
This program downloads many pdfs and works on other machines, however when putting it on another machine with Windows Server 2016 Standard it shows an error.
The function that is causing the error is:
def download_doc(pasta_pdf,base_links):
os.chdir(pasta_pdf)
for link in base_links['Link_Download_Regulamento']:
if link != None:
wget.download(link)
else:
continue
download_doc(pasta_origem,df_regulamentos_novos)
The error print:
enter image description here
Thanks for your assistance.
You got
HTTPError: HTTP Error 403: Forbidden
If you got information about HTTP response status code, but do not know what it does mean, then you might consult developer.mozilla.org docs, in this case this is 403 Forbidden
The client does not have access rights to the content; that is, it is
unauthorized, so the server is refusing to give the requested
resource. Unlike 401, the client's identity is known to the server.
Documentation: https://python-gerrit-api.readthedocs.io/en/latest/
Code
gerrit = GerritClient(base_url="https://gerrit.xx.com",username='xxx',password='xxx')
change = gerrit.changes.get("xxx")
ab=change.get_revision("32423")
print(ab.get_commit().list_change_files())
Question
For some endpoints, I am able to send get responses from the rest api but via this package I get this error(gerrit.utils.exceptions.NotFoundError: 404 Client Error). I am able to get response from Get Rest api for this url: gerrit.xx.xx.com/a/projects/xxxx/commits/xxxx/files via postman. But error with above code.
Looks like this is a bug, I have fixed it and made a pull request. See: https://github.com/shijl0925/python-gerrit-api/pull/5
When my deployed Flask application has an error, I only see a standard error message in the browser.
Internal Server Error
The server encountered an internal error and was unable to complete
your request. Either the server is overloaded or there is an error in
the application.
Going through the logs to find the error is inconvenient. How can I output the error to the browser instead?
For debugging purposes you may try this:
import traceback
#app.errorhandler(Exception)
def handle_500(e=None):
app.logger.error(traceback.format_exc())
return 'Internal server error occured', 500
I'm using Flask with Apache. When I send a GET request with a long url (19000+ characters), the response is
Status 414: Request-URI Too Large.
I suspect that the request triggers a werkzeug RequestURITooLarge Exception or a flask HTTPException. When I send a request with similar url length to Apache directly there is no error.
Is there a way to increase the maximum url length that Flask handles?
You can use POST instead of GET, but if you don't need to use it i think this question have related answer for your problem.
How do I resolve a HTTP 414 "Request URI too long" error?