How to connect to Kerberos authenticated REST service in Python on Windows

I am trying to create a very simple Python script to load the contents of an internal service in my company, which is located in our firewall and is authenticated using keberos.

When I installed the request_kerberos module, I first edited import kerberos in it to use import kerberos_sspi as kerberos instead after installing the kerberos_sspi module.

So I have the following Python script

 import requests from requests_kerberos import HTTPKerberosAuth response = requests.get('http://service.internaldomain',auth=HTTPKerberosAuth()) print response 

When you try to process 401, it crashes with an error.

 error: (-2146893053, 'InitializeSecurityContext', 'The specified target is unknown or unreachable') 

If I look to see if I could do this with curl , I ran kinit and noticed that it asked me for an authorization password with the following hint:

 Password for username@additionalInternalDomain.internaldomain 

So I wondered if this could be causing the problem.

+6
source share

Source: https://habr.com/ru/post/982530/


All Articles