-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsharepoint.py
32 lines (24 loc) · 1009 Bytes
/
sharepoint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 1 18:00:21 2018
@author: v.shkaberda
"""
import os
def sharepoint_check():
''' Check connection to sharepoint. If no - try to mount a drive.
'''
print('Проверка связи с sharepoint...')
test_sharepoint = R'\\sharepoint.fozzy.lan\sites\logistics\vegetables_fruits'
if not os.path.isdir(test_sharepoint):
print('Монтирование диска sharepoint...')
sharepoint_url = 'http://sharepoint.fozzy.lan'
os.system('net use r: {}'.format(sharepoint_url))
if not os.path.isdir(test_sharepoint):
print('Доступ к sharepoint не установлен. \
Пожалуйста, зайдите на ресурс вручную.')
return
print('Диск смонтирован. Доступ к sharepoint установлен.')
return
print('Sharepoint доступен.')
if __name__ == '__main__':
sharepoint_check()