inpython-package 1.0.3__tar.gz → 1.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. inpython_package-1.0.8/PKG-INFO +44 -0
  2. inpython_package-1.0.8/README.md +30 -0
  3. inpython_package-1.0.8/inpython/aotools/__init__.py +6 -0
  4. inpython_package-1.0.8/inpython/aotools/aogeo.py +61 -0
  5. inpython_package-1.0.8/inpython/ingraph/ingraph.py +53 -0
  6. inpython_package-1.0.8/inpython/intools/Servalux-devis.py +58 -0
  7. inpython_package-1.0.8/inpython/intools/__init__.py +6 -0
  8. inpython_package-1.0.8/inpython/intools/in_docx.py +61 -0
  9. inpython_package-1.0.8/inpython/intools/in_projet.py +55 -0
  10. inpython_package-1.0.8/inpython/intools/in_test.py +4 -0
  11. inpython_package-1.0.8/inpython/intools/xls_to_csv.py +45 -0
  12. inpython_package-1.0.8/inpython_package.egg-info/PKG-INFO +44 -0
  13. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython_package.egg-info/SOURCES.txt +8 -0
  14. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython_package.egg-info/requires.txt +1 -0
  15. {inpython-package-1.0.3 → inpython_package-1.0.8}/setup.py +4 -3
  16. inpython-package-1.0.3/PKG-INFO +0 -35
  17. inpython-package-1.0.3/README.md +0 -23
  18. inpython-package-1.0.3/inpython/ingraph/ingraph.py +0 -65
  19. inpython-package-1.0.3/inpython_package.egg-info/PKG-INFO +0 -35
  20. {inpython-package-1.0.3 → inpython_package-1.0.8}/LICENSE.txt +0 -0
  21. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython/__init__.py +0 -0
  22. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython/__main__.py +0 -0
  23. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython/ingraph/__init__.py +0 -0
  24. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython_package.egg-info/dependency_links.txt +0 -0
  25. {inpython-package-1.0.3 → inpython_package-1.0.8}/inpython_package.egg-info/top_level.txt +0 -0
  26. {inpython-package-1.0.3 → inpython_package-1.0.8}/setup.cfg +0 -0
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.1
2
+ Name: inpython-package
3
+ Version: 1.0.8
4
+ Summary: # Infodata's IN-Tools U2Python Package
5
+ Home-page: https://bitbucket.org/infodata-dev/inpython
6
+ Author: infodata
7
+ Author-email: efv@infodata.lu
8
+ License: MIT
9
+ Requires-Python: >=3.4
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.txt
12
+ Requires-Dist: msal>=1.22
13
+ Requires-Dist: qrcode
14
+
15
+ # README
16
+
17
+ Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
18
+
19
+ ## sub-package **inpython.ingraph**
20
+
21
+ package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
22
+
23
+ ## How do I get set up?
24
+
25
+ * Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
26
+ * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
27
+ * Vérifier la version de u2Python, au TCL uv
28
+
29
+ ```python
30
+ >python
31
+ import sys
32
+ print(sys.version)
33
+ print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
34
+ print('\n'.join(sys.path)) # les path en cours
35
+ exit()
36
+ ```
37
+
38
+ ## Install inPackages into U2python
39
+
40
+ * `pip3 install inpython-package`
41
+
42
+ ## Manage Package
43
+
44
+ * c.f. [devREADME](devREADME.md)
@@ -0,0 +1,30 @@
1
+ # README
2
+
3
+ Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
4
+
5
+ ## sub-package **inpython.ingraph**
6
+
7
+ package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
8
+
9
+ ## How do I get set up?
10
+
11
+ * Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
12
+ * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
13
+ * Vérifier la version de u2Python, au TCL uv
14
+
15
+ ```python
16
+ >python
17
+ import sys
18
+ print(sys.version)
19
+ print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
20
+ print('\n'.join(sys.path)) # les path en cours
21
+ exit()
22
+ ```
23
+
24
+ ## Install inPackages into U2python
25
+
26
+ * `pip3 install inpython-package`
27
+
28
+ ## Manage Package
29
+
30
+ * c.f. [devREADME](devREADME.md)
@@ -0,0 +1,6 @@
1
+ # inpython.aotools init file
2
+ # executed when 'from inpython.aotools import *'
3
+
4
+ # !! update the list when new modules are added !!
5
+
6
+ __all__ = ["aogeo"]
@@ -0,0 +1,61 @@
1
+ """Always-On geocoding module
2
+
3
+ Content :
4
+ =========
5
+ distance_calculation : Calculate distance between 2 points or multiple points on earth
6
+ offset_calculation : Calculate one or more GPS coordinates from an initial point based on a given azimuth and distance
7
+ """
8
+
9
+ import geopy.distance
10
+ from latlon import *
11
+
12
+
13
+ def distance_calculation(origin, coordinates):
14
+ """Calculate distance between 2 points or multiple points on earth
15
+
16
+ Usage :
17
+ =======
18
+ origin (tuple) : The origin from which we want to calculate distances
19
+ coordinates (list) : Points used to calculate the distance
20
+
21
+ Example :
22
+ =========
23
+ distance_calculation((52.2296756, 21.0122287), [(52.406374, 16.9251681), (52.606374, 16.5251681)])
24
+ Output = [279.35290160430094, 308.0962131498814]
25
+ """
26
+ try:
27
+ return [geopy.distance.geodesic(
28
+ origin, coordinate).km for coordinate in coordinates]
29
+ except Exception as e:
30
+ raise e
31
+
32
+
33
+ def offset_calculation(origin, azimuths_and_distances):
34
+ """ Calculate one or more GPS coordinates from an initial point based on a given azimuth and distance
35
+
36
+ Usage :
37
+ =======
38
+ origin (tuple) : The origin from which we want to calculate offsets
39
+ azimuths_and_distances (list) : List of azimuths and distances
40
+
41
+ Example :
42
+ =========
43
+ offset_calculation((52.2296756, 21.0122287), [(0, 279.35290160430094), (50, 308.0962131498814)])
44
+ Output = 54.739690349825885,21.01222870000001|53.95616765233316,24.60854517315002
45
+ """
46
+ try:
47
+ origin = LatLon(Latitude(origin[0]), Longitude(origin[1]))
48
+ points = [origin.offset(azim, dist)
49
+ for azim, dist in azimuths_and_distances]
50
+ points = ["{0},{1}".format(point.lat, point.lon) for point in points]
51
+ return "|".join(points)
52
+ except Exception as e:
53
+ raise e
54
+
55
+
56
+ if __name__ == "__main__":
57
+ print("Hello from aogeo")
58
+ print(distance_calculation(
59
+ (52.2296756, 21.0122287), [(52.406374, 16.9251681), (52.606374, 16.5251681)]))
60
+ print(offset_calculation((52.2296756, 21.0122287), [
61
+ (0, 279.35290160430094), (50, 308.0962131498814)]))
@@ -0,0 +1,53 @@
1
+ # infodata' u2python module to work with ..GRAPH... intools
2
+ # efv 20240403 elimine le finaly car cela efface les erreurs
3
+ import sys
4
+ import json
5
+ import msal
6
+
7
+
8
+ def helloWorld():
9
+ print("hello from inpython.ingraph")
10
+
11
+
12
+ def getGraphTokenFromCertificate(path):
13
+ # fonctions pour générer un token Graph avec un certificat
14
+ # retourne un objet string json ou un erreur python
15
+ # {
16
+ # "token_type": "Bearer",
17
+ # "expires_in": 3599,
18
+ # "ext_expires_in": 3599,
19
+ # "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZS..."
20
+ # }
21
+ # c.f. https://github.com/Azure-Samples/ms-identity-python-daemon/tree/master/2-Call-MsGraph-WithCertificate
22
+ #-------------------------------------------------------------------------------------------------------------
23
+ # load config file .json
24
+ # {
25
+ # "authority": "https://login.microsoftonline.com/infodata.lu",
26
+ # "tenant_id": "e2a26e34-3...",
27
+ # "client_id": "15855fc2-...",
28
+ # "scope": [ "https://graph.microsoft.com/.default" ],
29
+ # "thumbprint": "9615472D8...",
30
+ # "private_key_file": "...//9615472D8...//9615472D8....privatekey"
31
+ # }
32
+ result = ''
33
+ try:
34
+ # open & load config
35
+ f_path = open(path)
36
+ config = json.load(f_path)
37
+ # open & load private key
38
+ f_privatekey = open(config['private_key_file'])
39
+ privatekey = f_privatekey.read()
40
+ # connect to the app
41
+ msal_app = msal.ConfidentialClientApplication(
42
+ config["client_id"],
43
+ authority=config["authority"],
44
+ client_credential={"thumbprint": config["thumbprint"],
45
+ "private_key": privatekey},
46
+ )
47
+ # try to get a token
48
+ result = msal_app.acquire_token_for_client(scopes=config["scope"])
49
+ result = json.dumps(result)
50
+ return result
51
+ except:
52
+ # toute exception issue de la séquence try arrive ici et est remontée à l'appelant 'uvpython'
53
+ raise # pour que l'appelant reçoive l'exception
@@ -0,0 +1,58 @@
1
+ from docx import Document
2
+
3
+ def chk_br(par):
4
+ for run in par.r_lst:
5
+ if len(run.br_lst) > 0:
6
+ return(True)
7
+ return(False)
8
+
9
+ def build_word_file(doc_directory,fab_filename,skipped_pg_br,keeped_pg_br):
10
+ tmp_file = doc_directory + "/schemas.docx"
11
+
12
+ print(fab_filename)
13
+ doc_fab = Document(fab_filename)
14
+ doc_fab.save(tmp_file)
15
+ doc_tmp = Document(tmp_file)
16
+
17
+ # extraction des pages du docuemnt fabriquant
18
+ num_page_breaks = 0
19
+
20
+ state = 0
21
+
22
+ for elt_idx, elt in enumerate(doc_tmp.element.body):
23
+ print(elt.tag)
24
+ if state == 0:
25
+ if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
26
+ if chk_br(elt):
27
+ num_page_breaks += 1
28
+ if num_page_breaks == 2:
29
+ doc_tmp.save(tmp_file)
30
+ state = 1
31
+ doc_tmp.element.body.remove(elt)
32
+ elif state == 1:
33
+ if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
34
+ if chk_br(elt):
35
+ num_page_breaks += 1
36
+ if num_page_breaks == 3:
37
+ state = 2
38
+ doc_tmp.element.body.remove(elt)
39
+ #doc_tmp.add_paragraph()
40
+ #elif elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tbl":
41
+ #table_copy(elt, doc_fab, doc_tmp)
42
+ elif state == 2:
43
+ if elt.tag != "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sectPr":
44
+ doc_tmp.element.body.remove(elt)
45
+
46
+ print("save " + tmp_file)
47
+ doc_tmp.save(tmp_file)
48
+
49
+ return(tmp_file)
50
+
51
+ def build_devis(doc_directory,fab_filename,startdoc,end_doc):
52
+ tmp_doc = build_word_file(doc_directory,fab_filename,2,1)
53
+ print(tmp_doc)
54
+
55
+ doc_dir = "Q:/is/chantier/1000/"
56
+ fab_fn = "Q:/is/chantier/1000/FABRIQUANT/1000.docx"
57
+
58
+ build_devis(doc_dir,fab_fn,"","")
@@ -0,0 +1,6 @@
1
+ # inpython.ingraph init file
2
+ # executed when 'from inpython.ingraph import *'
3
+
4
+ # !! update the list when new modules are added !!
5
+
6
+ __all__ = ["xls_to_csv", "in_projet", "in_docx","in_test"]
@@ -0,0 +1,61 @@
1
+ from docx import Document
2
+ from docxcompose.composer import Composer
3
+
4
+ def chk_br(par):
5
+ for run in par.r_lst:
6
+ if len(run.br_lst) > 0:
7
+ return(True)
8
+ return(False)
9
+
10
+ def doc_extract(doc_directory,fab_filename,skipped_pg_br,keeped_pg_br):
11
+ tmp_file = doc_directory + "/schemas.docx"
12
+
13
+ doc_fab = Document(fab_filename)
14
+ doc_fab.save(tmp_file)
15
+ doc_tmp = Document(tmp_file)
16
+
17
+ # extraction des pages du docuemnt fabriquant
18
+ num_page_breaks = 0
19
+
20
+ state = 0
21
+
22
+ for elt_idx, elt in enumerate(doc_tmp.element.body):
23
+ if state == 0:
24
+ if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
25
+ if chk_br(elt):
26
+ num_page_breaks += 1
27
+ if num_page_breaks == 2:
28
+ doc_tmp.save(tmp_file)
29
+ state = 1
30
+ doc_tmp.element.body.remove(elt)
31
+ elif state == 1:
32
+ if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
33
+ if chk_br(elt):
34
+ num_page_breaks += 1
35
+ if num_page_breaks == 3:
36
+ state = 2
37
+ doc_tmp.element.body.remove(elt)
38
+ #doc_tmp.add_paragraph()
39
+ #elif elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tbl":
40
+ #table_copy(elt, doc_fab, doc_tmp)
41
+ elif state == 2:
42
+ if elt.tag != "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sectPr":
43
+ doc_tmp.element.body.remove(elt)
44
+
45
+ doc_tmp.save(tmp_file)
46
+
47
+ return(tmp_file)
48
+
49
+ def compose_doc(base_file,files_list,final_doc):
50
+ files_list = files_list.split(";")
51
+ master = Document(base_file)
52
+ composer = Composer(master)
53
+ for filename in files_list:
54
+ doc_temp = Document(filename)
55
+ composer.append(doc_temp)
56
+ composer.save(final_doc)
57
+ return
58
+
59
+ if __name__ == '__main__':
60
+ flist = ['//winprod/commun/is/chantier/1000/schemas.docx', '//winprod/commun/is/chantier/1000/1000_DETAIL.docx', '//winprod/commun/is/chantier/_doc_base/Formulaire_ALU_cgv.docx']
61
+ compose_doc('//winprod/commun/is/chantier/_doc_base/Formulaire_ALU_1-3.docx',flist,'//winprod/commun/is/chantier/1000/Devis.docx')
@@ -0,0 +1,55 @@
1
+ from docx import Document
2
+ from docx.shared import Pt
3
+ import csv
4
+
5
+ def hello_world():
6
+ print('Hello world fron in_projet')
7
+
8
+ def build_projet(txt_filename,tpl_filename,doc_filename):
9
+ doc_prj = Document(tpl_filename)
10
+ font_size = Pt(8)
11
+
12
+ ret = False
13
+ table = doc_prj.tables[0]
14
+
15
+ data = []
16
+ # Ouvrir le fichier en mode lecture
17
+ with open(txt_filename, 'r', encoding="utf-8") as file:
18
+ # Créer un lecteur CSV
19
+ reader = csv.reader(file, delimiter=';') # Spécifiez le délimiteur approprié si nécessaire
20
+ for rowidx, row in enumerate(reader):
21
+ if rowidx >= 11:
22
+ if len(row) > 0:
23
+ data.append(row)
24
+
25
+ current_pos = ''
26
+ for posidx, pos in enumerate(data[0]):
27
+ if pos != "X":
28
+ current_pos = data[1][posidx]
29
+ cells = table.add_row().cells
30
+ cells[0].text = data[1][posidx]
31
+ cells[0].paragraphs[0].runs[0].font.bold = True
32
+ text = str(data[4][posidx])
33
+ cells[1].text = text.replace("|","\r")
34
+ cells[2].text = data[3][posidx]
35
+ cells[3].text = data[13][posidx]
36
+ cells[4].text = data[5][posidx]
37
+ cells[5].text = data[11][posidx]
38
+ cells[6].text = data[12][posidx]
39
+
40
+ #else:
41
+ # print("desigantion = ",data[4][posidx])
42
+
43
+ for cell in table._cells:
44
+ for paragraph in cell.paragraphs:
45
+ for run in paragraph.runs:
46
+ run.font.size = font_size
47
+ run.font.name = 'Calibri'
48
+
49
+ doc_prj.save(doc_filename)
50
+ ret = True
51
+ return(ret)
52
+
53
+ if __name__ == '__main__':
54
+ arguments = sys.argv
55
+
@@ -0,0 +1,4 @@
1
+
2
+ def hello_world:
3
+ print("salut les aminches")
4
+ return("ça roule ma poule!")
@@ -0,0 +1,45 @@
1
+ import pandas as pd
2
+ import sys
3
+ import csv
4
+
5
+ def hello_world():
6
+ print('Hello world fron xls_to_csv')
7
+
8
+ def parse_csv(csv_file):
9
+ # Ouvrir le fichier CSV en mode lecture
10
+ with open(csv_file, newline='') as csvfile:
11
+ # Créer un lecteur CSV
12
+ lecteur_csv = csv.reader(csvfile, delimiter=';')
13
+ donnees = list(lecteur_csv)
14
+ # Parcourir chaque ligne du fichier CSV
15
+ for lindex, ligne in enumerate(donnees):
16
+ # Parcourir chaque cellule de la ligne
17
+ for cindex, cellule in enumerate(ligne):
18
+ if len(cellule) > 0:
19
+ donnees[lindex][cindex] = cellule.replace('\n','|')
20
+
21
+ with open(csv_file, 'w', newline='') as fichier_sortie:
22
+ writer_csv = csv.writer(fichier_sortie, delimiter=';')
23
+ # Écrire les données modifiées dans le nouveau fichier CSV
24
+ writer_csv.writerows(donnees)
25
+
26
+
27
+ def convert_to_csv(xls_file,csv_file):
28
+ df = pd.read_excel(xls_file)
29
+ df.to_csv(csv_file, index=False, sep=';')
30
+ parse_csv(csv_file)
31
+ return
32
+
33
+ if __name__ == '__main__':
34
+ arguments = sys.argv
35
+
36
+ if len(arguments) == 3:
37
+ xl_filename = arguments[1].replace('\\','/') # Premier argument
38
+ csv_filename = arguments[2].replace('\\','/') # Deuxième argument
39
+ convert_to_csv(xl_filename, csv_filename)
40
+ else:
41
+ xl_filename = "Q:/is/chantier/1000/1000_DETAIL.xlsx" # Premier argument
42
+ csv_filename = "Q:/is/chantier/1000/1000_DETAIL.csv" # Deuxième argument
43
+ convert_to_csv(xl_filename, csv_filename)
44
+ print("Veuillez spécifier des arguments.")
45
+
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.1
2
+ Name: inpython-package
3
+ Version: 1.0.8
4
+ Summary: # Infodata's IN-Tools U2Python Package
5
+ Home-page: https://bitbucket.org/infodata-dev/inpython
6
+ Author: infodata
7
+ Author-email: efv@infodata.lu
8
+ License: MIT
9
+ Requires-Python: >=3.4
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.txt
12
+ Requires-Dist: msal>=1.22
13
+ Requires-Dist: qrcode
14
+
15
+ # README
16
+
17
+ Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
18
+
19
+ ## sub-package **inpython.ingraph**
20
+
21
+ package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
22
+
23
+ ## How do I get set up?
24
+
25
+ * Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
26
+ * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
27
+ * Vérifier la version de u2Python, au TCL uv
28
+
29
+ ```python
30
+ >python
31
+ import sys
32
+ print(sys.version)
33
+ print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
34
+ print('\n'.join(sys.path)) # les path en cours
35
+ exit()
36
+ ```
37
+
38
+ ## Install inPackages into U2python
39
+
40
+ * `pip3 install inpython-package`
41
+
42
+ ## Manage Package
43
+
44
+ * c.f. [devREADME](devREADME.md)
@@ -3,8 +3,16 @@ README.md
3
3
  setup.py
4
4
  inpython/__init__.py
5
5
  inpython/__main__.py
6
+ inpython/aotools/__init__.py
7
+ inpython/aotools/aogeo.py
6
8
  inpython/ingraph/__init__.py
7
9
  inpython/ingraph/ingraph.py
10
+ inpython/intools/Servalux-devis.py
11
+ inpython/intools/__init__.py
12
+ inpython/intools/in_docx.py
13
+ inpython/intools/in_projet.py
14
+ inpython/intools/in_test.py
15
+ inpython/intools/xls_to_csv.py
8
16
  inpython_package.egg-info/PKG-INFO
9
17
  inpython_package.egg-info/SOURCES.txt
10
18
  inpython_package.egg-info/dependency_links.txt
@@ -9,9 +9,9 @@ with open("README.md", "r") as fh:
9
9
 
10
10
  setup(
11
11
  name="inpython-package",
12
- version="1.0.3",
12
+ version="1.0.8",
13
13
  author="infodata",
14
- author_email="info@infodata.lu",
14
+ author_email="efv@infodata.lu",
15
15
  packages=find_packages(),
16
16
  description="# Infodata's IN-Tools U2Python Package",
17
17
  long_description=description,
@@ -20,6 +20,7 @@ setup(
20
20
  license='MIT',
21
21
  python_requires='>=3.4',
22
22
  install_requires=[
23
- 'msal >= 1.22'
23
+ 'msal >= 1.22',
24
+ 'qrcode'
24
25
  ]
25
26
  )
@@ -1,35 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: inpython-package
3
- Version: 1.0.3
4
- Summary: # Infodata's IN-Tools U2Python Package
5
- Home-page: https://bitbucket.org/infodata-dev/inpython
6
- Author: infodata
7
- Author-email: info@infodata.lu
8
- License: MIT
9
- Requires-Python: >=3.4
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE.txt
12
-
13
- # README #
14
-
15
- ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
16
-
17
- # inpython.ingarph
18
- package pour la gestion avec MS-Graph.
19
-
20
- ### How do I get set up? ###
21
-
22
- * les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
23
- * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
24
- * vérifier la version de u2Python, au TCL uv
25
- ```python
26
- >python
27
- import sys
28
- sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
29
- exit()
30
- ```
31
-
32
- ### Install inPackages into U2python
33
- `pip install inpython-package`
34
-
35
-
@@ -1,23 +0,0 @@
1
- # README #
2
-
3
- ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
4
-
5
- # inpython.ingarph
6
- package pour la gestion avec MS-Graph.
7
-
8
- ### How do I get set up? ###
9
-
10
- * les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
11
- * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
12
- * vérifier la version de u2Python, au TCL uv
13
- ```python
14
- >python
15
- import sys
16
- sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
17
- exit()
18
- ```
19
-
20
- ### Install inPackages into U2python
21
- `pip install inpython-package`
22
-
23
-
@@ -1,65 +0,0 @@
1
- # infodata' u2python module to work with ..GRAPH... intools
2
- import sys
3
- import json
4
- import msal
5
-
6
- def helloWorld():
7
- print("hellp from inpython")
8
-
9
-
10
-
11
- def getGraphTokenFromCertificate(path):
12
- # fonctions pour générer un token Graph avec un certificat
13
- # retourne un objet string json
14
- #
15
- # c.f.
16
- # https://github.com/Azure-Samples/ms-identity-python-daemon/tree/master/2-Call-MsGraph-WithCertificate
17
-
18
- # load config file .json
19
- # {
20
- # "authority": "https://login.microsoftonline.com/infodata.lu",
21
- # "tenant_id": "e2a26e34-3...",
22
- # "client_id": "15855fc2-...",
23
- # "scope": [ "https://graph.microsoft.com/.default" ],
24
- # "thumbprint": "9615472D8...",
25
- # "private_key_file": "...//9615472D8...//9615472D8....privatekey"
26
- # }
27
-
28
- try:
29
- f = open(path)
30
- config = json.load(f)
31
- except: # catch *all* exceptions
32
- result = {"errorCode" : "1",
33
- "errorFrom" : "json.load({0})".format(path),
34
- "error" : "{0}".format(sys.exc_info()[0])
35
- }
36
- print(result)
37
- return json.dumps(result)
38
-
39
- # try to connect
40
- try:
41
- app = msal.ConfidentialClientApplication(
42
- config["client_id"],
43
- authority=config["authority"],
44
- client_credential={"thumbprint": config["thumbprint"],
45
- "private_key": open(config['private_key_file']).read()},
46
- )
47
- except:
48
- result = {"errorCode" : "2",
49
- "errorFrom" : "msal.ConfidentialClientApplication(authority={authority}, client_credentials=thumbprint={thumbprint}, privatekey={privatekey})".format(authority=config["authority"], thumbprint=config["thumbprint"], privatekey=config['private_key_file']),
50
- "error" : "{0}".format(sys.exc_info()[0])
51
- }
52
- return json.dumps(result)
53
-
54
- # try to get a token
55
- result = None
56
- try:
57
- result = app.acquire_token_for_client(scopes=config["scope"])
58
- except:
59
- result = {"errorCode" : "3",
60
- "errorFrom" : "app.acquire_token_for_client {scopes}=".format(scopes=config["scope"]) ,
61
- "error" : "{0}".format(sys.exc_info()[0])
62
- }
63
- return json.dumps(result)
64
-
65
- return json.dumps(result)
@@ -1,35 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: inpython-package
3
- Version: 1.0.3
4
- Summary: # Infodata's IN-Tools U2Python Package
5
- Home-page: https://bitbucket.org/infodata-dev/inpython
6
- Author: infodata
7
- Author-email: info@infodata.lu
8
- License: MIT
9
- Requires-Python: >=3.4
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE.txt
12
-
13
- # README #
14
-
15
- ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
16
-
17
- # inpython.ingarph
18
- package pour la gestion avec MS-Graph.
19
-
20
- ### How do I get set up? ###
21
-
22
- * les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
23
- * [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
24
- * vérifier la version de u2Python, au TCL uv
25
- ```python
26
- >python
27
- import sys
28
- sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
29
- exit()
30
- ```
31
-
32
- ### Install inPackages into U2python
33
- `pip install inpython-package`
34
-
35
-