SSL error with Python but server test gives all A+ ratings - python

Last year I wrote a Python script to query the SEC's EDGAR database to retrieve their index of company filings for various years and quarters. At the time, the script worked fine but I recently picked it back up only to find that now I receive SSL: CERTIFICATE_VERIFY_FAILED errors whenever running it.
I did an SSL Server test on the the following path:
https://www.sec.gov/Archives/edgar/full-index/2018/QTR2/company.idx
The report indicates all passes for the certificate (linked here)
Also interestingly, if you navigate directly to the path in browser, an "Access Denied" error is returned. If I'm remembering correctly, in the past this would have led to the index file being downloaded. I know that the SEC's EDGAR database has recently gone through some restructuring as they no longer support FTP services.
Does anyone have any idea what might be happening here and why I get SSL errors?
For further background, I'm using urllib.request.urlopen()
Thanks in advance.

Took a bit of digging, but I found the answer to this question. Full credit to Craig Glennie who posted the answer in a response to a question elsewhere on Stack Overflow:
urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error
I didn't realize that the out of the box Python 3.6 installed on OS-X does not have any certificates (as detailed in the ReadMe.rtf file with Python 3.6). Running /Applications/Python\ 3.6/Install\ Certificates.command got everything squared away.

Related

Maximum retries exhausted. Could not install VS Code server on [azure compute instance name]: Cannot communicate with the Jupyter endpoint

I am trying to edit my jupyter notebook which is in Azure ML Workspace. I use the 'edit-in vscode' option, it opens the vs-code or when I try to connect to compute instance directly from vs code, then I am getting the following error:
[Info - 2021-11-08 07:06:06.885] Using commit id "b3318bc0524af3d74034b8bb8a64df0ccf35549a" and quality "stable" for server
[Error - 2021-11-08 07:06:06.971] Invalid response: 405 Method Not Allowed
[Error - 2021-11-08 07:06:06.971] Cannot communicate with the Jupyter endpoint.
[Error - 2021-11-08 07:06:07.981] Maximum retries exhausted. Could not install VS Code server on saksham-dubey: Cannot communicate with the Jupyter endpoint.
Earlier it was working fine and I had no issues with vs-code, I was able to edit/run files directly but without changing anything, it started giving me problem.
So far, I have tried uninstalling/removing vscode completely, reinstall it, deleting Azure compute instance and creating a fresh instance but nothing worked, I am still facing the issue.
What is the problem here and how to resolve this?
ps- saksham-dubey is my compute instance name, which is a Azure Compute Instance (Nvidia Tesla K80 GPU)
Been dealing with the same issue since Friday, tried pretty much anything to no avail.
Luckily I found a workaround by enabling SSH on a new GPU instance & connecting to the instance through Remote SSH from VS Code.
Will keep posted if I found a solution for the UI access.
I found the fix to the problem.
The problem was caused due to some backend error in the 'Azure Machine Learning' vs-code extension.
The issue was caused in the version: 0.6.26
The fix was implemented on the version: 0.6.27
Updating your vs-code extension will make it work.
For any further information you can refer: Github Link to vscode-tools-for-ai
Also you can open an issue on same Github page, if anything like this happens again.

Failed to write data to connection Adress (neo4j python

I use the neo4j python driver to write to my database.
I have my neo4j DB setup and was using ita few days ago without any issues.
Today i run my code and i get the following error:
Failed to write data to connection Address(host='localhost',
port=7687) (Address(host='xxx.x.x.x', port=7687));
("0; 'Underlying socket connection gone (_ssl.c:xxxx)'")
When i check via the browser and execute MATCH (n) RETURN n, it appears that all my querys still get executed bc i can find nodes in the database.
I shut my pc down, reinstalled neo4j and basically everything else.
(Its not only for CREATE statements but also for match statemenets)
Adding this at the end of the script worked for me.
db.driver.close()
Asusming you're using this driver, I suspect it might be related to this bug in neo4j-python-driver. It looks like their latest version fixes the bug, according to comments in the thread, but if not, maybe just downgrade back to whatever you were running before, and you should be fine.
It's usually a good idea to lock down your dependencies to avoid problems like this. Have a look at tools like pipenv or poetry if you're not familiar with them, they should save you a few headaches.
I'm uncertain where the issue lies, but the solve it to downgrade to python driver versions:
neo4j: 1.72
neobolt: 1.75
neotime: 1.75

Error while trying to attach debugger from PTVS

I have created a Bottle Py website and deployed it to Azure Websites, but now I have made some changes and when I published it Site again, the site gave an internal error. When I tried to attach debugger received below error
"Existing connection is forcefully closed by remote host"
Update: I posted the same in PTVS Discussions and got the answer there, possibly this might get fixed in RTM.
https://pytools.codeplex.com/discussions/551920
Did you enable web sockets for your website in Azure management console?

Arelle Xbrl validation - unable to start web service - socket error 10013

I'm using the Arelle project to implement validation of my Xbrl files.
http://arelle.org/documentation/api-web-services/
When i try to start the webserver that i can call from my code i receive following error.
Been looking up how to fix this and it all points to disabling my antivirus. Got it disabled and i still get this error. Arelle is a Python project
This should start a webservice that i can reach on www.localhost:8082/rest/xbrl
Appearently this was an issue with the previous release of the project.
I installed the latest version 2013-07-25 and no longer had this socket error

Why does django jython connection to a MySQL database give a "Communication Link Failure"?

I'm trying to convert a django / cPython app to run as a Tomcat WAR using Jython. We are using a mysql database (MySQLdb in cPython / mysql-connector-java-5.1.15-bin.jar in jython). I have changed the DATABASE_ENGINE between the two configurations. The app runs great with cPython (after I disabled SELinux limitations on http connections to a database). The front page, images, and static content work in the jython. However, when I request a page that hits the database, it seems to hang for a while, then returns with:
Communications link failure
The last packet sent successfully to
the server was 0 milliseconds ago. The
driver has not received any packets
from the server. [SQLCode: 0],
[SQLState: 08S01]
Has anyone seen this before? I don't see any recent discussions of this type or problem. I'm using django 1.2.5, jython 2.5.2. I've tried running the Java app under Fedora (jre-1.6.0-openjdk.x86_64) and Windows (Java(TM) SE Runtime Environment (build 1.6.0_23-b05)). Same behavior. I've also tried both mysql-connector-java-5.1.15-bin.jar (the latest version) and mysql-connector-java-5.1.10-bin.jar ("extensively tested" according to http://packages.python.org/django-jython/database-backends.html). None of the various configurations affect the behavior.
How can I solve it or where should I look next?
I found the mistake. In hindsight, it's obvious. I made a type-o in the IP address of the database server, but only in the configuration file on the jython branch. As a result, the Jython instance hung while the cPython instance didn't. Found the error when I merged the two into a single settings.py (using "if os.name=='java'" to make the necessary jython changes.
So . . . What's the correct protocol here? Should I delete the question or leave it up in case someone else makes the same type of mistake I did?

Categories