# http



# auth_call

**Descripción**

Autenticación para petición url. Requiere el objeto request.sessions.Session().

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="height: 162px; width: 515px;"><tbody><tr style="height: 29px;"><td style="width: 77px; height: 29px;">**Nombre**</td><td style="width: 77px; height: 29px;">**Tipo**</td><td style="width: 361px; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 77px;">session </td><td style="width: 77px; height: 29px;">None</td><td style="height: 29px; width: 361px;">objeto Session() de request</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 77px;">authtype </td><td style="width: 77px; height: 29px;">str</td><td style="height: 29px; width: 361px;">'ntlm', 'basic' o 'digest'</td></tr><tr style="height: 46px;"><td style="width: 77px; height: 46px;"><div><div>user </div></div></td><td style="width: 77px; height: 46px;"><div><div>str</div></div></td><td style="width: 361px; height: 46px;">Usuario de autenticación</td></tr><tr style="height: 29px;"><td style="width: 77px; height: 29px;"><div><div>passw </div></div></td><td style="width: 77px; height: 29px;"><div><div>str</div></div></td><td style="width: 361px; height: 29px;">Contraseña de autenticación</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-tipo-none" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 100%;">**Tipo**</td></tr><tr><td style="width: 100%;">None</td></tr></tbody></table>

 **Requisitos**

- <div><div>requests_ntlm.HttpNtlmAuth</div></div>
- <div><div>requests.auth.HTTPBasicAuth</div></div>
- <div><div><div>requests.auth.HTTPDigestAuth</div></div></div><div>  
    </div>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Create a request session
session = pt.requests.Session()

# Define authentication details
authtype = 'basic'
user = 'admin'
passw = 'S4n3tk!'

# Call the authentication function
pt._auth_call(session, authtype, user, passw)

# Now you can use the authenticated session to make URL requests
url = 'https://api.com/api/data'
response = session.get(url)

# Print the response
print(response.text)
```

# call_url

**Descripción**

Utiliza el módulo request para obtener el contenido de la URL.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="height: 191px; width: 515px;"><tbody><tr style="height: 29px;"><td style="width: 77px; height: 29px;"><div><div>**Nombre**</div></div></td><td style="width: 77px;"><div><div>**Tipo**</div></div></td><td style="width: 361px; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 77px;"><div><div>url</div></div></td><td style="width: 77px;"><div><div>str</div></div></td><td style="height: 29px; width: 361px;">Url objetivo.</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 77px;"><div><div>authtype</div></div></td><td style="width: 77px;"><div><div>str</div></div></td><td style="height: 29px; width: 361px;">ntlm', 'basic', 'digest'. Opcional.</td></tr><tr style="height: 46px;"><td style="width: 77px; height: 46px;"><div><div><div><div>user</div></div></div></div></td><td style="width: 77px;"><div><div><div><div>str</div></div></div></div></td><td style="width: 361px; height: 46px;">Usuario de autenticación. Opcional.</td></tr><tr style="height: 29px;"><td style="width: 77px; height: 29px;"><div><div><div><div>passw</div></div></div></div></td><td style="width: 77px;"><div><div><div><div>str</div></div></div></div></td><td style="width: 361px; height: 29px;">Contraseña de autenticación. Opcional.</td></tr><tr style="height: 29px;"><td style="width: 77px; height: 29px;"><div><div>time_out</div></div></td><td style="width: 77px;"><div><div>int</div></div></td><td style="width: 361px; height: 29px;">Time out para la llamada.</td></tr></tbody></table>

**Return**

<table border="1" id="bkmrk-output-salida-de-la-" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 50%;">**Tipo**</td><td style="width: 50%;">**Descripción**</td></tr><tr><td style="width: 50%;">str</td><td style="width: 50%;">Salida de la petición request.</td></tr></tbody></table>

**Requisitos**

- <div><div><div>requests.sessions.Session</div></div></div><div>  
    </div>

**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define URL and authentication details
url = 'https://api.com/api/data'
authtype = 'basic'
user = 'admin'
passw = 'S4!jdKm'

# Call the URL and get the contents
response = pt.call_url(url, authtype=authtype, user=user, passw=passw, timeout=5, verify=True, print_errors=True)

# Print the response content
if response is not None:
    print(response.decode('utf-8'))
else:
    print("Error occurred during URL call.")
```