python - How to make urllib use my own network code for the actual http GETPUT... operations? - Stack Overflow

I need to configure urllib in Anaconda Python 3.6 to use my own python code to do the actual GET, PUT,

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745615465a4636208.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信