1 Star 0 Fork 0

Anesthesia丶 / Sharepoint Tool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Sharepoint Tool

介绍

一个可以从sharepoint下载、上传文件的工具。不使用Graph API,而使用playwright的方式巧妙的进行文件的操作。 一次性登录,后续可无人值守,作为batch进行调用。 感兴趣就来看看吧~

CSDN博客主页:https://blog.csdn.net/qq_36991535?spm=1000.2115.3001.5343

环境要求

python: 3.8.5 os: windows 10

安装教程

  1. pip install -r reqirements.txt

使用说明

  1. 配置global.json文件
{
  "chrome_path": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", # 谷歌浏览器chrome.exe文件路径
  "user_data_dir": "user_data_dir", # 浏览器缓存目录,可以是相对路径,也可以是绝对路径
  "always_show": false, # 控制是否始终显示浏览器
  "page_timeout": 30000, # 画面加载的超时时间设定ms
  "login_timeout": 300000, # 登录的超时时间ms
  "win_size": "800,600", # 浏览器的窗口大小设定
  "win_posi": "0,0", # 浏览器的位置设定
  "base_url": "https://fujitsu.sharepoint.com/teams/msteams_d54409", # sharepoint的路径
  "login_selector": "#leftRegion", # 登录成功的判断css选择器
  "login_url": "https://www.office.com/?auth=2", # 登录地址设定,以office365主页为登录地址,也可以以任何office365的任何产品为登陆地址
  "max_retry_count": 5, # 最大重试次数配置
  "retry_interval": 5, # 重试间隔配置 s
  "output_folder": "output", # 输出路径指定
  "proxy": "http://xxx.xxx.xxx.xxx:xxxx", # 代理设定,不需要代理时指定为null
  "spo_folder": "/電子契約プラットフォーム運用", # 文件存放的sharepoint路径
  "file_name": "20220330_1.PNG" # sharepoint路径下的文件名
}
  1. 配置文件global.json后可以直接执行以下命令

python spo_file_download.py

或者你也可以不使用配置,直接使用传参的方式进行启动,注意只有spo_folderfile_name是必须配置的 优先级 命令参数 > global.json配置文件 例:

python spo_file_download.py --spo_folder="/電子契約プラットフォーム運用" --file_name="20220330_1.PNG"

  1. 使用pyinstaller打包成exe

pyinstaller -F spo_file_download.py

执行方式和2.完全相同。

关联技术文档

playwright官网: https://playwright.dev/python/docs/intro

pyinstaller: https://pypi.org/project/pyinstaller/

项目亮点

  1. 浏览器可缓存用户登录信息,次回启动可免登录下载,定时执行或batch调用都可以
  2. 可设置无头模式,后台运行,不影响工作
  3. 浏览器可定制化
MIT License Copyright (c) 2023 Anesthesia丶 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个可以从sharepoint下载、上传文件的工具。不使用Graph API,而使用playwright的方式巧妙的进行文件的操作。 一次性登录,后续可无人值守,作为batch进行调用。 感兴趣就来看看吧~ 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/zjw_xqb/sharepoint-tool.git
git@gitee.com:zjw_xqb/sharepoint-tool.git
zjw_xqb
sharepoint-tool
Sharepoint Tool
master

搜索帮助