admin管理员组文章数量:1026254
I need to configure urllib in Anaconda Python 3.6 to use my own python code to do the actual GET, PUT, ... operations. The solution will be native python code and wrap the curl cli to do the acutal operation.
I'm working in a highly restrictive environment where I cannot install any software on my workstation. This limits me to Anaconda Python 3.6 with no ability to install pip modules. In this environment, I and my colleagues are using a set of python programs to collect information from internal APIs via an internal proxy. This proxy will soon be switched from basic authentication to NTLM authentication, which is not supported by Anaconda Python 3.6.
In the search for a solution, we noticed, that the 'curl' that comes with git-bash on our workstation does support NTLM authentication and can access our APIs. I made a small POC python module to wrap the curl cli tool do http requests and it worked fine. Now I'm searching for a way to use the curl tool without the need to completely rewrite all our existing code. I've already experimented with deriving classes from urllib.request.BaseHandler and urllib.request.HTTPBaseHandler, but apparently they're not meant to replace the actual networking code.
So, what would be your approach to make urllib use the curl cli command to do the actual requests? I'm aware that wrapping curl is horrible and I'm very open for alternative solutions, as long as they don't require additional software installation.
I need to configure urllib in Anaconda Python 3.6 to use my own python code to do the actual GET, PUT, ... operations. The solution will be native python code and wrap the curl cli to do the acutal operation.
I'm working in a highly restrictive environment where I cannot install any software on my workstation. This limits me to Anaconda Python 3.6 with no ability to install pip modules. In this environment, I and my colleagues are using a set of python programs to collect information from internal APIs via an internal proxy. This proxy will soon be switched from basic authentication to NTLM authentication, which is not supported by Anaconda Python 3.6.
In the search for a solution, we noticed, that the 'curl' that comes with git-bash on our workstation does support NTLM authentication and can access our APIs. I made a small POC python module to wrap the curl cli tool do http requests and it worked fine. Now I'm searching for a way to use the curl tool without the need to completely rewrite all our existing code. I've already experimented with deriving classes from urllib.request.BaseHandler and urllib.request.HTTPBaseHandler, but apparently they're not meant to replace the actual networking code.
So, what would be your approach to make urllib use the curl cli command to do the actual requests? I'm aware that wrapping curl is horrible and I'm very open for alternative solutions, as long as they don't require additional software installation.
本文标签: pythonHow to make urllib use my own network code for the actual http GETPUT operationsStack Overflow
版权声明:本文标题:python - How to make urllib use my own network code for the actual http GETPUT... operations? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745615463a2159263.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论