Git Product home page Git Product logo

onedrivecmd's People

Contributors

cnbeining avatar dictxiong avatar elgarfo avatar tao-kun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onedrivecmd's Issues

error while run mkdir command

error while run mkdir command

onedrivecmd list od:/
od:/图片/ 0 2019-03-20T11:09:22.270000Z
od:/文档/ 0 2019-03-20T11:09:22.663000Z
od:/OneDrive 入门.pdf 1159342 2019-03-20T11:09:23.210000Z

onedrivecmd mkdir od:/backups
Traceback (most recent call last):
File "/usr/bin/onedrivecmd", line 11, in
sys.exit(main())
File "/usr/lib/python2.7/site-packages/onedrivecmd/onedrivecmd.py", line 79, in main
do_mkdir(client, args)
File "/usr/lib/python2.7/site-packages/onedrivecmd/utils/actions.py", line 447, in do_mkdir
parent_id = req['id']
KeyError: u'id'

无法上传目录

[root@myhostkvm path]# onedrivecmd put /pt/ od:/movies/
....
OSError: [Errno 2] No such file or directory: '/pt/'
[root@myhostkvm dd.hostflyte.cn]# cd pt
[root@myhostkvm pt]# ls
Brotherhood of Blades II The Infernal Battlefield 2017 WEB-DL 2160P.mp4
Dragon Tattoo 2019 4K WEB-DL H264 AAC-PTHome.mp4
Who Sleeps My Bro 2016 WEB-DL 1080p H264 AAC-PTHome.mp4
哪个少女不多情之脱的疑惑.mkv

我想把PT目录整体上传到onedrive的movies目录,请问下我的命令是对的吗?为啥出错了?是不是中文原因?
系统是python2.7 centos7.6

无法下载含有中文名字的文件或文件夹

使用python3版本提示

redapple@redapple-System-Product-Name ~> onedrivecmd -hack get od:/文档.docx
Traceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 11, in
load_entry_point('OnedriveCMD==0.1.3', 'console_scripts', 'onedrivecmd')()
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/onedrivecmd.py", line 61, in main
do_get(client, args)
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/utils/actions.py", line 188, in do_get
execute_cmd(cmd)
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/utils/helper_file.py", line 27, in execute_cmd
os.system(cmd.decode("utf-8").encode(sys.stdout.encoding))
AttributeError: 'str' object has no attribute 'decode'
redapple@redapple-System-Product-Name ~>

python2提示

redapple@redapple-System-Product-Name ~> onedrivecmd -hack get od:/文档.docx
Traceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 9, in
load_entry_point('OnedriveCMD==0.1.3', 'console_scripts', 'onedrivecmd')()
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/onedrivecmd.py", line 61, in main
do_get(client, args)
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/actions.py", line 161, in do_get
item = get_remote_item(client, path = f)
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/helper_item.py", line 31, in get_remote_item
f = client.item(drive='me', path = path).get()
File "/usr/local/lib/python2.7/dist-packages/onedrivesdk/extensions/one_drive_client_helper.py", line 49, in item
return drive_builder.item_by_path(path)
File "/usr/local/lib/python2.7/dist-packages/onedrivesdk/extensions/drive_request_builder_helper.py", line 41, in item_by_path
return ItemRequestBuilder(self.append_to_request_url("root:/"+str(path)+":"), self._client)
File "/usr/local/lib/python2.7/dist-packages/onedrivesdk/request_builder_base.py", line 48, in append_to_request_url
return self._request_url + "/" + url_segment
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)
redapple@redapple-System-Product-Name ~>

去不去掉-hack都一样

请求增加上传自动重试功能

上传一堆大文件太痛苦了,不能上传文件夹,用*.*上传又不稳定,动不动程序就退出,而且程序退出后已上传的文件貌似还不会保存是可以保存的,quota查询的已用容量不太准。
所以可否加入对每个文件的自动重试以增强多文件上传体验?

有什么办法直接能挂载到本地盘linux下

找了好多都不行 用你这个脚本可以用了不错
这个好像不支持目录上传下载 文件上传多了会断

不知道神牛什么时候弄个挂本地硬盘的 像 google-drive-ocamlfuse 一样挂到本地 直接就能本地操作了

onedrivecmd - impossible to use - onedrivesdk deprecated

Microsoft Windows [Versione 10.0.18362.329]
(c) 2019 Microsoft Corporation. Tutti i diritti sono riservati.

C:\Users\Andrea>pip -V
pip 19.0.3 from c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)

C:\Users\Andrea>pip install onedrivecmd
Requirement already satisfied: onedrivecmd in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (0.1.6)
Requirement already satisfied: progress in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from onedrivecmd) (1.5)
Requirement already satisfied: onedrivesdk in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from onedrivecmd) (2.0)
Requirement already satisfied: requests in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from onedrivecmd) (2.22.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from requests->onedrivecmd) (1.25.3)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from requests->onedrivecmd) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from requests->onedrivecmd) (2019.6.16)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages (from requests->onedrivecmd) (2.8)
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\Andrea>onedrivecmd
Traceback (most recent call last):
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\actions.py", line 10, in
from static import *
ModuleNotFoundError: No module named 'static'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\uploader.py", line 12, in
from static import *
ModuleNotFoundError: No module named 'static'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\onedrivecmd.py", line 8, in
from onedrivecmd.utils.actions import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\actions.py", line 17, in
from .uploader import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\uploader.py", line 18, in
from .helper_item import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\helper_item.py", line 7, in
import onedrivesdk
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivesdk_init_.py", line 6, in
raise ImportError(MESSAGE)
ImportError: 'onedrivesdk' has been deprecated.
Visit https://pypi.org/project/onedrivesdk for migration information.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\actions.py", line 10, in
from static import *
ModuleNotFoundError: No module named 'static'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\uploader.py", line 12, in
from static import *
ModuleNotFoundError: No module named 'static'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Andrea\AppData\Local\Programs\Python\Python37-32\Scripts\onedrivecmd-script.py", line 11, in
load_entry_point('OnedriveCMD==0.1.6', 'console_scripts', 'onedrivecmd')()
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\pkg_resources_init_.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\pkg_resources_init_.py", line 2793, in load_entry_point
return ep.load()
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\pkg_resources_init_.py", line 2411, in load
return self.resolve()
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\pkg_resources_init_.py", line 2417, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\onedrivecmd.py", line 16, in
from .utils.actions import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\actions.py", line 17, in
from .uploader import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\uploader.py", line 18, in
from .helper_item import *
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivecmd\utils\helper_item.py", line 7, in
import onedrivesdk
File "c:\users\andrea\appdata\local\programs\python\python37-32\lib\site-packages\onedrivesdk_init_.py", line 6, in
raise ImportError(MESSAGE)
ImportError: 'onedrivesdk' has been deprecated.
Visit https://pypi.org/project/onedrivesdk for migration information.

C:\Users\Andrea>

SEARCH failed

All the files hosted in OneDrive have a file identification (fileid) that allows a faster download of them. Each time I upload a file I get it'ss fileid and store it in a database to facilitate the download.
I tried to get it with the SEARCH command but it is not working for me (Log at the end).
As an additional question ... can I use GET with a FILEID?
Thank you
Best regards
Ángel(ALQS2D)

A:>onedrivecmd -conf A:/ODCMD/.onedrive.json list od:/ALQS2D/
od:/DAT/ 52363505378 2015-01-02T10:45:26.853000Z
od:/FILE70se 225146 2019-01-13T06:51:08.250000Z
od:/FILEWITHOUTEXTENSION 18 2019-01-13T06:47:36.233000Z
od:/PRUEBA.txt 18 2019-01-13T02:15:27.403000Z

A:>onedrivecmd -conf A:/ODCMD/.onedrive.json get od:/ALQS2D/PRUEBA.txt
←[KDownloading |################################| 100.0% - 0s
←[?25h
A:>

A:>onedrivecmd -conf A:/ODCMD/.onedrive.json search PRUEBA.txt
Traceback (most recent call last):
File "C:\Python372\Scripts\onedrivecmd-script.py", line 11, in
load_entry_point('OnedriveCMD==0.1.6', 'console_scripts', 'onedrivecmd')()
File "c:\python372\lib\site-packages\onedrivecmd\onedrivecmd.py", line 88, in main
do_search(client, args)
File "c:\python372\lib\site-packages\onedrivecmd\utils\actions.py", line 589, in do_search
item_list = get_search_item_list_single_page_by_url_rec(requests_session, access_token, search_url, item_list = [])
File "c:\python372\lib\site-packages\onedrivecmd\utils\helper_item.py", line 92, in get_search_item_list_single_page_by_url_rec
for json_item in req.json()['value']:
KeyError: 'value'

Can't download folder

尝试下载one上面的文件夹时报错,现在是不支持文件夹下载吗?
分别用python2和python3装了一次,报错一样

onedrivecmd get od:/vps/ ./bak/

Traceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/onedrivecmd.py", line 61, in main
do_get(client, args)
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/utils/actions.py", line 173, in do_get
item_info = get_item_temp_download_info(item)
File "/usr/local/lib/python3.5/dist-packages/onedrivecmd/utils/helper_item.py", line 70, in get_item_temp_download_info
file_info = convert_utf8_dict_to_dict(item.to_dict())
AttributeError: 'ChildrenCollectionPage' object has no attribute 'to_dict'

能否直接上传目录?

onedrivecmd [OPTIONS] put /tmp/hello.txt od:/bar/ 上传

这条命令能否直接改为

onedrivecmd [OPTIONS] put /tmp/ od:/bar/

来上传tmp目录全部文件?

move

Hi,
I find 'move' among the commands and in the todo list. In the former move is from remote to remote location but if I write

  onedrivecmd mkdir bar/
  onedrivecmd move foo bar/ 

it gives the error

   Traceback (most recent call last):
     File "/usr/local/bin/onedrivecmd", line 11, in <module>
       sys.exit(main())
     File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/onedrivecmd.py", line 82, in main
       do_move(client, args)
     File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/actions.py", line 476, in do_move
       if to_item.folder:
   AttributeError: 'ItemRequestBuilder' object has no attribute 'folder'

Is this because move is not yet deployed?
Thanks a lot
Roberto

Can't share folders

If I do something like

onedrivecmd share "od:/folder/subfolder/file.ext"

I get a URL which works. However, if I try it with a folder:

onedrivecmd share "od:/folder/subfolder"

I get the following error:

Traceback (most recent call last):
  File "c:\programdata\miniconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\miniconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Miniconda3\Scripts\onedrivecmd.exe\__main__.py", line 9, in <module>
  File "c:\programdata\miniconda3\lib\site-packages\onedrivecmd\onedrivecmd.py", line 70, in main
    do_share(client, args)
  File "c:\programdata\miniconda3\lib\site-packages\onedrivecmd\utils\actions.py", line 244, in do_share
    permission = client.item(id = item.id).create_link("view").post()
AttributeError: 'ChildrenCollectionPage' object has no attribute 'id'

Is folder sharing supposed to work?

可以按目录分享吗?

昨晚上我试了下只能按文件分享,按文件分享会报 ChildrenCollectionPage(不记得是不是这个类名了) 没有id, 我看了下代码分享是 permission = client.item(id = item.id).create_link("view").post(), 只支持用文件, 对应 onedrive python sdk,也没找到有目录分享的的接口,不知道能不能实现

这个是什么情况 能上传不能下载

root@debian-7-372187076-cp234:~# onedrivecmd get od:/speedtest.py
Traceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/onedrivecmd.py", line 61, in main
do_get(client, args)
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/actions.py", line 213, in do_get
bar.next()
File "/usr/local/lib/python2.7/dist-packages/progress/init.py", line 73, in next
self.update()
File "/usr/local/lib/python2.7/dist-packages/progress/bar.py", line 33, in update
filled_length = int(self.width * self.progress)
File "/usr/local/lib/python2.7/dist-packages/progress/init.py", line 103, in progress
return min(1, self.index / self.max)
ZeroDivisionError: division by zero

我快绝望了,上传失败,下载偶尔成功

上传失败:

上传不到1m的小文件svn.txt ,而且是英文命名的

$ odcmd put /home/ubuntu/Downloads/svn.txt od:/
Path (/LiveFolders//svn.txt) contains invalid leading character.(报错)

上传文件名含有中文字符的pdf也报错,不到20m:

Traceback (most recent call last):
File "/home/ubuntu/.local/bin/odcmd", line 11, in
sys.exit(main())
File "/home/ubuntu/.local/lib/python2.7/site-packages/onedrivecmd/onedrivecmd.py", line 67, in main
do_put(client, args)
File "/home/ubuntu/.local/lib/python2.7/site-packages/onedrivecmd/utils/actions.py", line 393, in do_put
chunksize = int(args.chunk))
File "/home/ubuntu/.local/lib/python2.7/site-packages/onedrivecmd/utils/uploader.py", line 69, in upload_self
api_url = api_base_url + 'drive/root:{dest_path}:/upload.createSession'.format(dest_path = dest_path)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 13: ordinal not in range(128)

下载失败:

不含有中文字符,大小就不到10m:

$ odcmd get od:/SwitchyOmega_Chromium.crx ./

Traceback (most recent call last):
File "/home/ubuntu/.local/bin/odcmd", line 11, in
sys.exit(main())
File "/home/ubuntu/.local/lib/python2.7/site-packages/onedrivecmd/onedrivecmd.py", line 61, in main
do_get(client, args)
File "/home/ubuntu/.local/lib/python2.7/site-packages/onedrivecmd/utils/actions.py", line 203, in do_get
total_length = int(r.headers.get('content-length'))
TypeError: int() argument must be a string or a number, not 'NoneType'

下载含有中文字符的也报错:

报错同上

系统:Ubuntu 18.04 LTS
已绝望😞😞😞😞😞😞😞😞😞😞

上传经常会报命令错误

放出来我命令行的记录

root@server-1039065-1:/opt/drive# onedrivecmd put Young.Mom.2018.HDTV.WebRip.x264.720p-KOREANZ.mkv od:/
The request is malformed or incorrect.
root@server-1039065-1:/opt/drive# onedrivecmd put Young.Mom.2018.HDTV.WebRip.x264.720p-KOREANZ.mkv od:/
The request is malformed or incorrect.
root@server-1039065-1:/opt/drive# onedrivecmd put -verbose debug Young.Mom.2018.HDTV.WebRip.x264.720p-KOREANZ.mkv od:/
usage: onedrivecmd [-h] [--version] [-chunk CHUNK] [-conf CONF] [-force]
                   [-recursive] [-asc] [-desc] [-hack] [-url]
                   [-verbose {DEBUG,INFO,WARNING,ERROR}]
                   {init_business,init,get,list,put,delete,mkdir,move,remote,quota,share,direct,search}
onedrivecmd: error: argument -verbose: invalid choice: 'debug' (choose from 'DEBUG', 'INFO', 'WARNING', 'ERROR')
root@server-1039065-1:/opt/drive# onedrivecmd put -verbose DEBUG Young.Mom.2018.HDTV.WebRip.x264.720p-KOREANZ.mkv od:/
Uploading |##################              | 57.1% - 53s

可以看到我传一个视频,一直是报错误的,但是加上 -verbose DEBUG 之后就神器的成功了

大文件上传中断?

Uploading |############################### | 98.6% - 117s/usr/local/lib/python2.7/dist-packages/requests/packages/ur
llib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 fr
om configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version o
f Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-w
arnings                                                                                                             
  InsecurePlatformWarning                                                                                           
Uploading |############################### | 98.8% - 96s/usr/local/lib/python2.7/dist-packages/requests/packages/url
lib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 fro
m configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of
 Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-wa
rnings                                                                                                              
  InsecurePlatformWarning                                                                                           
Traceback (most recent call last):                                                                                  
  File "onedrivecmd.py", line 79, in <module>                                                                       
    main()                                                                                                          
  File "onedrivecmd.py", line 61, in main                                                                           
    do_put(client, args)                                                                                            
  File "/root/onedrivecmd/utils/actions.py", line 300, in do_put                                                    
    chunksize = int(args.chunk))                                                                                    
  File "/root/onedrivecmd/utils/uploader.py", line 83, in upload_self                                               
    range_this=i, file_size= file_size)                                                                             
  File "/root/onedrivecmd/utils/uploader.py", line 41, in upload_one_piece                                          
    headers = headers)                                                                                              
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 124, in put                                   
    return request('put', url, data=data, **kwargs)                                                                 
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request                                
    return session.request(method=method, url=url, **kwargs)                                                        
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request                          
    resp = self.send(prep, **send_kwargs)                                                                           
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send                             
    r = adapter.send(request, **kwargs)                                                                             
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 473, in send                             
    raise ConnectionError(err, request=request)                                                                     
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))                
                                                                       

4G文件,onedrive for business 教育版,两次都上传失败~
另外,上传速度能不能优化一下?以及是否有断点上传?

离线下载用不了

出错如下:

onedrivecmd remote http://xxxxxxx od:/Nein
Traceback (most recent call last):
  File "/usr/bin/onedrivecmd", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/onedrivecmd/onedrivecmd.py", line 85, in main
    do_remote(client, args)
  File "/usr/lib/python3.6/site-packages/onedrivecmd/utils/actions.py", line 525, in do_remote
    print(req.headers['location'])
  File "/usr/lib/python3.6/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'location'

API失效了吗?

Office 365 登录失败

微软账户已购买 Office 365 家庭版,账户状态正常, onedrivecmd init 初始化正常

使用 onedrivecmd init_business 登录提示如下

AADSTS50020: User account '***@live.cn' from identity provider 'live.com' does not exist in tenant 'yanzi' and cannot access the application '6fd4-c905-4612-bd23-306c3918217c' in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.

这个是微软的问题吗😂

recursive listing fails

recursive listing is failing because do_list always lists the same folder over and over (a trace takes up to 5 minutes to appear).

你好,反馈debian8 Python 2.7.9下一些问题

python onedrivecmd.py list od:/
python onedrivecmd.py mkdir od:/xxx

都可以。

上传文件错误
$python onedrivecmd.py put ./README.md od:/
Traceback (most recent call last):
File "onedrivecmd.py", line 73, in
main()
File "onedrivecmd.py", line 58, in main
do_put(client, args)
File "/data/onedrivecmd/utils/actions.py", line 263, in do_put
client.item(drive="me", path=target_dir).upload_async(i)

AttributeError: 'ItemRequestBuilder' object has no attribute 'upload_async'

列目录成功
$python onedrivecmd.py list od:/
od:/test/ 0 2016-09-27T07:56:32.000000Z
od:/xu06d.jpg 189001 2016-09-27T07:33:35.000000Z

下载文件错误
$python onedrivecmd.py get od:/xu06d.jpg
Traceback (most recent call last):
File "onedrivecmd.py", line 73, in
main()
File "onedrivecmd.py", line 52, in main
do_get(client, args)
File "/data/onedrivecmd/utils/actions.py", line 156, in do_get
item_info = get_item_temp_download_info(item)
File "/data/onedrivecmd/utils/helper_item.py", line 65, in get_item_temp_download_info
file_info['file']['hashes']['sha1Hash'].encode('utf-8'))
KeyError: 'sha1Hash'

安装了aria2加-hack下载也是出错
$python onedrivecmd.py -hack get od:/xu06d.jpg
Traceback (most recent call last):
File "onedrivecmd.py", line 73, in
main()
File "onedrivecmd.py", line 52, in main
do_get(client, args)
File "/data/onedrivecmd/utils/actions.py", line 156, in do_get
item_info = get_item_temp_download_info(item)
File "/data/onedrivecmd/utils/helper_item.py", line 65, in get_item_temp_download_info
file_info['file']['hashes']['sha1Hash'].encode('utf-8'))
KeyError: 'sha1Hash'

以上是在office365 onedrive for business测试,因为不懂py程序所以不知到底是什么问题。难道还要在office365后台设置什么?有时间看看。

上传日文文件(或含有特殊字符)错误

[root@161068 onedrivecmd]# python3 onedrivecmd.py put /var/lib/transmission/Downloads/00/[SOME_JAPANESE].rar  od:/
Traceback (most recent call last):
  File "onedrivecmd.py", line 9, in <module>
    from utils.actions import * 
  File "/root/onedrivecmd/utils/actions.py", line 8, in <module>
    from static import * 
ModuleNotFoundError: No module named 'static'
[root@161068 onedrivecmd]# python onedrivecmd.py put /var/lib/transmission/Downloads/00/[SOME_JAPANESE].rar  od:/
Traceback (most recent call last):
  File "onedrivecmd.py", line 79, in <module>
    main()
  File "onedrivecmd.py", line 61, in main
    do_put(client, args)
  File "/root/onedrivecmd/utils/actions.py", line 300, in do_put
    chunksize = int(args.chunk))
  File "/root/onedrivecmd/utils/uploader.py", line 60, in upload_self
    api_url = api_base_url + 'drive/root:{dest_path}:/upload.createSession'.format(dest_path = dest_path)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 12: ordinal not in range(128)

OneDrive For Business
请不要在意上传的内容..
我是用的是python2.7.5 也就是centos7默认的样子.没有学过python,貌似是字符编码的问题?
如果需要for business账户进行debug我可以提供.

上传目录失败

python版本3.7通过pip安装, 使用business账号登录
执行 onedrivecmd put /path/Artbook/ od:/Book/ 上传目录失败
在od:/Book/目录下新生成了一个0字节的文件(文件名~tmpF4_)

报错如下:
Uploading |################################| 100.0% - 0sTraceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 10, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/onedrivecmd/onedrivecmd.py", line 67, in main
do_put(client, args)
File "/usr/local/lib/python3.7/dist-packages/onedrivecmd/utils/actions.py", line 393, in do_put
chunksize = int(args.chunk))
File "/usr/local/lib/python3.7/dist-packages/onedrivecmd/utils/uploader.py", line 101, in upload_self
range_this = i, file_size = file_size, requests_session = requests_session)
File "/usr/local/lib/python3.7/dist-packages/onedrivecmd/utils/uploader.py", line 33, in upload_one_piece
file_piece = file_read_seek_len(source_file, range_this[0], content_length)
File "/usr/local/lib/python3.7/dist-packages/onedrivecmd/utils/helper_file.py", line 38, in file_read_seek_len
with open(filename, 'rb') as f:
IsADirectoryError: [Errno 21] Is a directory: '/path/Artbook/'

麻烦空的时候修正下typo

安装依赖的时候使用pip install -r requirements.txt,两次都提示文件不存在,仔细看了才发现原来是requirments.txt。虽然照着写也成功了,但还是希望大牛抽空的时候把typo修正一下吧。

The get command cannot write to another folder in windows 10

In the example below the "input" folder exists and I want the downloaded file to be written into that folder.

(py36) C:\Users\autrip\Documents\charting\charting>onedrivecmd get "od:/Data Center Weekly Update.xlsx" input
�[KDownloading |################################| 100.0% - 0s
�[?25hWARNING:root:File input do not exist!

上传错误KeyError: 'uploadUrl'

root@ns3032500:~/onedrivecmd# python onedrivecmd.py put ./README.md od:/mp4/
Traceback (most recent call last):
File "onedrivecmd.py", line 79, in
main()
File "onedrivecmd.py", line 61, in main
do_put(client, args)
File "/root/onedrivecmd/utils/actions.py", line 300, in do_put
chunksize = int(args.chunk))
File "/root/onedrivecmd/utils/uploader.py", line 67, in upload_self
uploadUrl = req.json()['uploadUrl'].encode('utf-8')
KeyError: 'uploadUrl'

貌似编码一直没搞好 (求个临时解决也好啊)

系统是ubuntu 16.04 上传正常
onedrivecmd list od:/

Traceback (most recent call last):
File "/usr/local/bin/onedrivecmd", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/onedrivecmd.py", line 64, in main
do_list(client, args)
File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/actions.py", line 331, in do_list
created_date_time = created_date_time))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-5: ordinal not in range(128)

文件目录或文件名称有中文时,无法上传

[root@172 ~]# onedrivecmd put /root/Downloads od:/upload
Traceback (most recent call last):
File "/usr/bin/onedrivecmd", line 11, in
load_entry_point('OnedriveCMD==0.1.8', 'console_scripts', 'onedrivecmd')()
File "build/bdist.linux-x86_64/egg/onedrivecmd/onedrivecmd.py", line 68, in main
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/actions.py", line 373, in do_put
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/uploader.py", line 142, in upload_self
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/uploader.py", line 142, in upload_self
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/uploader.py", line 142, in upload_self
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/uploader.py", line 80, in upload_self
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 3: ordinal not in range(128)

请求添加文件验证

通过校验hash和文件大小等方式对上传和下载的文件进行验证,避免重复上传和下载

Some Questions

First of all my gratitude for this magnificent tool that perfectly fulfills the function that I am looking for. And excuse my english, i hope you could understand me.

There are three issues that I can not clarify...

  1. The authorizations file (.json) is not automatically updated on each call, as in other platforms like GoogleDrive. Is there any way to keep or get one with the updated token for next calls?

  2. Conventional files (like .txt o .pdf) are uploaded or downloaded perfectly. But in case of nontype files, this is a file without extension, they show an error. Is there any solution for doing this?

  3. I would need to have an executable of type .exe build by Pyinstaller to be able to migrate an unique executable file to other family computers where I do not have python installed. Is that possible?

Many thanks

a cordial greeting

Ángel (ALQS2D)

ERROR SHOWED WHEN DOWNLOAD FILES WITHOUT EXTENSIONS

C:\Users\ANGEL>onedrivecmd -conf A:/ODCMD/.onedrive.json get od:/ALQS2D/DAT/11A7QC7iEY39i72t
Traceback (most recent call last):
File "C:\Python372\Scripts\onedrivecmd-script.py", line 11, in
load_entry_point('OnedriveCMD==0.1.6', 'console_scripts', 'onedrivecmd')()
File "c:\python372\lib\site-packages\onedrivecmd\onedrivecmd.py", line 61, in main
do_get(client, args)
File "c:\python372\lib\site-packages\onedrivecmd\utils\actions.py", line 203, in do_get
total_length = int(r.headers.get('content-length'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

登陆的链接,浏览器访问undefined,什么原因啊?

C:\WINDOWS\system32>onedrivecmd init_business
ATTENTION: This is for Onedrive Business and Office 365 only.
If you are using normal Onedrive, lease exit and run

onedrivecmd init

https://login.microsoftonline.com/common/oauth2/authorize?client_id=************马赛克***************c&response_type=code&redirect_uri=https%3A%2F%2Fod.cnbeining.com

Paste this URL into your browser, approve the app's access.
Copy all the code in the new window, and paste it below:
Paste code here:

1

[Question]离线下载

关于离线下载的api
这是个人版的
https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/api/driveitem_upload_url
这是企业版的
https://docs.microsoft.com/zh-cn/connectors/onedriveforbusiness/#copyfile
用来获取下载进度的
https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/concepts/long-running-actions
那么神奇的问题来了,我在Office Flow中调用此API只能传50m以下的文件,请问您是怎么实现传大文件的?

Running onedrivecmd from another pyhton script

Thank you for this package.
I'm a novice python user.
I've installed onedrivecmd with pip.
The following does not work.

import onedrivecmd
onedrivecmd.main('quota')
(py36) C:\Users\autrip\Documents\charting\one-drive>ipython
Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import onedrivecmd

In [2]: onedrivecmd.main('quota')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-a8e8966c1b54> in <module>()
----> 1 onedrivecmd.main('quota')

AttributeError: module 'onedrivecmd' has no attribute 'main'

In [3]:

上传报错 "Annotations must be specified before other elements in a JSON object"

上传时有几率在开始前报错 "Annotations must be specified before other elements in a JSON object". 即使是用相同的命令, 也会出现不同的结果, 如图.

Snipaste_2019-03-15_17-37-36

onedirup.py 是一个简单的目录上传脚本, 会先显示即将执行的命令后再执行命令. 两次运行得到了不同的结果, 之间没有做任何别的事情.

离线下载出错

账户是企业版E3订阅(Onedrive for business)

python3/python2 均已尝试

root@ubuntu:~/onedrive-cli-test-folder/onedrivecmd# python3 onedrivecmd.py remote "http://thecatapi.com/api/images/get?format=src&type=gif"
Traceback (most recent call last):
  File "onedrivecmd.py", line 79, in <module>
    main()
  File "onedrivecmd.py", line 73, in main
    do_remote(client, args)
  File "/root/onedrive-cli-test-folder/onedrivecmd/utils/actions.py", line 446, in do_remote
    print(req.headers['location'])
  File "/usr/lib/python3/dist-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'location'

implement an option to show full paths when listing recursively

currently the output of onedrive cmd for recursive lists looks like this

$ onedrivecmd -recursive list od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/
od:/navigation.js       3663    2017-05-12T20:11:44.693000Z
od:/searcher.js 6605    2017-05-12T20:11:45.613000Z
od:/js/ 10268   2017-05-12T20:11:43.833000Z
od:/.document   37      2017-05-12T20:11:43.363000Z

as there is no way of knowing which directory each line is referring to, i'd like to propose a -fullpath option, which makes it look like this:

$ onedrivecmd -fullpath -recursive list od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/
od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/js/navigation.js       3663    2017-05-12T20:11:44.693000Z
od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/js/searcher.js 6605    2017-05-12T20:11:45.613000Z
od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/js/    10268   2017-05-12T20:11:43.833000Z
od:/tools/cygwin64/usr/share/gems/gems/rdoc-4.3.0/lib/rdoc/generator/template/json_index/.document  37  2017-05-12T20:11:43.363000Z

i will create a pull request after #31 is resolved an patched. meanwhile you can take a look at it here: elgarfo@83feaa2

Trouble with PYINSTALLER

I have managed to operate this program according to my access needs to OneDrive. It works perfectly by running the sources with the python interpreter 3.7.2.

Now I am trying to generate an executable package through the PYINSTALLER program. The generated executable works correctly in the authentication and access, but when you want to obtain or list files the following error occurs

CMD------> odacce.exe a:/odparm.json GET od:/DAT/A/file.txt
RESULTS--> Traceback (most recent call last):
File "odacce.py", line 556, in
File "odacce.py", line 442, in do_get
File "odacce.py", line 274, in get_remote_item
AttributeError: 'OneDriveClient' object has no attribute 'item'
[5864] Failed to execute script odacce

The instruction that fails is f = client.item(drive = 'me', path = path).get()

I am investigating this error and the way to solve it. It could be a problem of PYINSTALLER, ONEDRIVEDSK or ONEDRIVECMD.

If any person has any suggestions on the matter I would be very grateful

Sincerely

Ángel[ALQS2D]

centos7 安装出错了

ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-TVAtBr/onedrivesdk/setup.py'"'"'; file='"'"'/tmp/pip-install-TVAtBr/onedrivesdk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-TVAtBr/onedrivesdk/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-TVAtBr/onedrivesdk/setup.py", line 9, in
with open(NOTICE, 'r', encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

几个问题求问

File "/usr/local/bin/onedrivecmd", line 9, in
load_entry_point('OnedriveCMD==0.1.4', 'console_scripts', 'onedrivecmd')()
File "build/bdist.linux-x86_64/egg/onedrivecmd/onedrivecmd.py", line 64, in main
File "build/bdist.linux-x86_64/egg/onedrivecmd/utils/actions.py", line 331, in do_list
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-5: ordinal not in range(128)

另外那个要是改成自己的域名 域名要怎么设置代码
我说的是后端设置 不是改你代码里的的那个https://od.cnbeining.com/

upload error

I use ubuntu16.04server
run onedrivecmd put /home/hatsuyuki/download/ubuntu16.04/ubuntu-16.04-server-amd64.iso od:/
then it's error
I pasted the error code
by hatsuyuki
PS the command onedrivecmd I write in alias

root@ubuntu:~# onedrivecmd put /home/hatsuyuki/download/ubuntu16.04/ubuntu-16.04-server-amd64.iso od:/ Traceback (most recent call last): File "/home/git/onedrivecmd/onedrivecmd.py", line 79, in <module> main() File "/home/git/onedrivecmd/onedrivecmd.py", line 61, in main do_put(client, args) File "/home/git/onedrivecmd/utils/actions.py", line 292, in do_put chunksize = int(args.chunk)) File "/home/git/onedrivecmd/utils/uploader.py", line 72, in upload_self range_this=i, file_size= file_size) File "/home/git/onedrivecmd/utils/uploader.py", line 35, in upload_one_piece headers = headers) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 123, in put return request('put', url, data=data, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 461, in request prep = self.prepare_request(req) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 394, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 295, in prepare self.prepare_headers(headers) File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 409, in prepare_headers check_header_validity(header) File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 800, in check_header_validity "not %s" % (value, type(value))) requests.exceptions.InvalidHeader: Header value 10485760 must be of type str or bytes, not <type 'int'>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.