I am using Azure Devops for CI/CD and encountered strange problem today. One of the python unit tests failed due to urllib3 connection time out. Here is the full output:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='goo.gl', port=443): Max retries exceeded with url: /maps/xxxxx (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001AE5F442320>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))
The strange thing is that; I logged in to build machine (it is a self-hosted Windows machine), tried to run same unit test with same configuration which azure devops build agent uses and test passed. By configuration I mean same conda environment and same Windows user which is "nt authority\network service" for azure devops build agent.
So here is the question why it is failing in the pipeline for no reason?
Related
I'm using ZAP to run a scan of a website from the command line, using the form-based authentication script found in the ZAP API Documentation.
java -jar ./zap-2.11.1.jar -script ./auth_script.py
However, it looks like ZAP uses Jython 2.7 instead of Python 3, so running the script this way doesn't work.
I've also tried running the script directly (i.e. python3 auth_script.py), but it throws the following error:
requests.exceptions.ProxyError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: http://zap/JSON/context/action/includeInContext/?contextName=context®ex=https%3A%2F%2Fwebsite.com%2F&apikey=9qFbZD4udTzFVYo0u5UzkZX9iuzbdcJDRAquTfRk
(Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))
Has anyone used this form-based authentication script before? How did you get it to work?
Basically there was an internet outage yesterday, and I tried to run my FastAPI python backend which calls API endpoints, I was getting this error during the outage and wasn't surprised since I had no internet.
However, now that i've got internet back, the API's are still not requesting properly ( Other developers i'm working with who didn't face this outage have no problems)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='www.api.com', port=443): Max retries exceeded with url: /filter/professor/?&page=5&filter=teacherlastname_sort_s+asc&query=*%3A*&queryoption=TEACHER&queryBy=schoolId&sid=4714 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000184D99C0D00>, 'Connection to www.api.com timed out. (connect timeout=5)'))
What I tried:
Re-installed all pip requirements
Re-installing the repo ( New virtual environment)
I was trying to look online, and people say some config files might have corrupted, still unsure abt this
I'm trying to develop a client-server application but I'm running into some issues. Both my services are developed locally in a separate docker container.
The client fetches data from the api using requests python library. It works in production but locally, I can't use:
requests.get("http://localhost:PORT/ENDPOINT")
It keeps giving me back:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=4000): Max retries exceeded with url: /data (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f352ccd42b0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Is there something I'm missing?
After further research, I found my answer here. Basically, when using Docker locally, you simply need to run:
requests.get("http://host.docker.internal:PORT/ENDPOINT")
instead of localhost
error shown is as follows:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Whenever I create StanfordCoreNLP for a parsing task,
StanfordCoreNLP('stanford-corenlp-full-2020-04-20', lang='en')
I get this logging
Initializing native server...
java -Xmx4g -cp "/stanford-corenlp-full-2020-04-20/*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9032
Server shell PID: 11991
The server is available.
Can StanfordCoreNLP work in python offline without connecting to the server?
Is there a command to stop the logging to screen in stanfordCoreNLP?
On applying
On applying the parser, self.nlp_src.parse(sentence), I got another logging of the form below:
{'properties': "{'annotators': 'pos,parse', 'outputFormat': 'json'}", 'pipelineLanguage': 'en'}
Is there a way to stop the above logging too?
Lastly, I got this error in the process of using the parser in the stanford coreNLP as explained above.
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=9032): Max retries exceeded with url: /?properties=%7B%27annotators%27%3A+%27pos%2Cparse%27%2C+%27outputFormat%27%3A+%27json%27%7D&pipelineLanguage=en (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe04121d6d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
What is the cause of this error? What do I do to prevent this?
Hi if you'd like to use Stanford CoreNLP in Python I'd advise using our official Python package Stanza, available here: https://stanfordnlp.github.io/stanza/
If you want to access Stanford CoreNLP in Python, Stanza will need to launch a Java server process on your local machine. This does not require connecting to the internet or any external network. The Java server process is running on your local machine and the Python process is communicating with it.
There is a detailed write up about how to launch a Java server in Python here: https://stanfordnlp.github.io/stanza/corenlp_client.html#overview
Stanza itself has part-of-speech, dependency parsing, and named entity recognition that is completely native Python and does not involve a server of any sort. More details here: https://stanfordnlp.github.io/stanza/installation_usage.html