1- #!/user/bin/env python3
2- # coding: utf-8
3-
4- import os
51import pathlib
62import re
73import time
117from bs4 import BeautifulSoup
128from lxml import etree
139from requests .auth import HTTPBasicAuth
14- from requests .sessions import session
1510
1611from . import constants as C
1712from .sap_api_common import _request , https_session
18- from .sap_id_sso import _get_sso_endpoint_meta , sap_sso_login
13+ from .sap_id_sso import _get_sso_endpoint_meta
1914
2015_MP_XSRF_TOKEN = None
2116_MP_TRANSACTIONS = None
2419def auth_maintenance_planner ():
2520 # Clear mp relevant cookies for avoiding unexpected responses.
2621 _clear_mp_cookies ('maintenanceplanner' )
27- res = _request (C .URL_MAINTAINANCE_PLANNER )
22+ res = _request (C .URL_MAINTENANCE_PLANNER )
2823 sig_re = re .compile ('signature=(.*?);path=\/";location="(.*)"' )
2924 signature , redirect = re .search (sig_re , res .text ).groups ()
3025
@@ -35,7 +30,7 @@ def auth_maintenance_planner():
3530 'locationAfterLogin' : '%2F'
3631 }
3732
38- MP_DOMAIN = C .URL_MAINTAINANCE_PLANNER .replace ('https://' , '' )
33+ MP_DOMAIN = C .URL_MAINTENANCE_PLANNER .replace ('https://' , '' )
3934 for k , v in mp_cookies .items ():
4035 https_session .cookies .set (k , v , domain = MP_DOMAIN , path = '/' )
4136
@@ -68,7 +63,7 @@ def auth_userapps():
6863
6964
7065def get_mp_user_details ():
71- url = urljoin (C .URL_MAINTAINANCE_PLANNER ,
66+ url = urljoin (C .URL_MAINTENANCE_PLANNER ,
7267 '/MCP/MPHomePageController/getUserDetailsDisplay' )
7368 params = {'_' : int (time .time () * 1000 )}
7469 user = _request (url , params = params ).json ()
0 commit comments