Problem with OneDrive backend

Bug #1655462 reported by Walter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Invalid
Medium
Unassigned

Bug Description

I already installed the python-requests and python-requests-oauthlib libraries but I am still unable to use the OneDrive backend.

Error Message:
OneDrive backend requires python-requests and python-requests-oauthlib to be installed. Please install them and try again.

$ pip install requests requests-oauthlib oauthlib
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: requests-oauthlib in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: oauthlib in /usr/local/lib/python2.7/site-packages

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

What OS? What duplicity version?

Changed in duplicity:
status: New → Incomplete
Revision history for this message
Walter (wmaldonado) wrote :

OSX Sierra 10.12.2 (16C67)
Duplicity 0.7.11

Changed in duplicity:
status: Incomplete → Confirmed
importance: Undecided → Medium
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote : Re: [Bug 1655462] Re: Problem with OneDrive backend

This is a weird one. Works fine in Python console.

ken@dione:~$ python
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> global requests
>>> global OAuth2Session
>>> import requests
>>> from requests_oauthlib import OAuth2Session
>>>

On Mon, Jan 16, 2017 at 10:43 AM, Walter <email address hidden> wrote:

> OSX Sierra 10.12.2 (16C67)
> Duplicity 0.7.11
>
> --
> You received this bug notification because you are subscribed to
> Duplicity.
> https://bugs.launchpad.net/bugs/1655462
>
> Title:
> Problem with OneDrive backend
>
> Status in Duplicity:
> Incomplete
>
> Bug description:
> I already installed the python-requests and python-requests-oauthlib
> libraries but I am still unable to use the OneDrive backend.
>
> Error Message:
> OneDrive backend requires python-requests and python-requests-oauthlib
> to be installed. Please install them and try again.
>
> $ pip install requests requests-oauthlib oauthlib
> Requirement already satisfied: requests in /usr/local/lib/python2.7/site-
> packages
> Requirement already satisfied: requests-oauthlib in
> /usr/local/lib/python2.7/site-packages
> Requirement already satisfied: oauthlib in /usr/local/lib/python2.7/site-
> packages
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/duplicity/+bug/1655462/+subscriptions
>

Revision history for this message
Walter (wmaldonado) wrote :

I thought this could be a problem with the two installations of python (one from brew and the other from osx). Although I tested the imports with the two versions and it also works good:

 walter  ~  python
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> global requests
>>> global OAuth2Session
>>> import requests
>>> from requests_oauthlib import OAuth2Session
>>>
 walter  ~  /usr/bin/python
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> global requests
>>> global OAuth2Session
>>> import requests
>>> from requests_oauthlib import OAuth2Session
>>>

Revision history for this message
Walter (wmaldonado) wrote :

Maybe it can be useful too, this is the whole command I am using with duplicity

(using the python from brew)

 walter  ~  /usr/local/bin/duplicity --allow-source-mismatch --volsize 5 --exclude-filelist /Users/walter/Work/Scripts/nonsynclist.txt --include-filelist /Users/walter/Work/Scripts/synclist.txt --exclude '**' /Users/walter/Work onedrive://Sync

BackendException: OneDrive backend requires python-requests and python-requests-oauthlib to be installed. Please install them and try again.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

I got mine to work by:

$ brew uninstall duplicity
$ wget https://launchpad.net/duplicity/0.7-series/0.7.11/+download/duplicity-0.7.11.tar.gz
$ tar xzf duplicity-0.7.11.tar.gz
$ cd duplicity-0.7.11
$ python setup.py install

Seems there's something funky about the brew install.

Changed in duplicity:
status: Confirmed → Fix Released
milestone: none → 0.7.12
Revision history for this message
Walter (wmaldonado) wrote :
Download full text (3.3 KiB)

Now I got the following:

/usr/local/bin/duplicity --allow-source-mismatch --volsize 5 --exclude-filelist /Users/walter/Work/Scripts/nonsynclist.txt --include-filelist /Users/walter/Work/Scripts/synclist.txt --exclude '**' /Users/walter/Work onedrive://Sync
Traceback (most recent call last):
  File "/usr/local/bin/duplicity", line 1546, in <module>
    with_tempdir(main)
  File "/usr/local/bin/duplicity", line 1540, in with_tempdir
    fn()
  File "/usr/local/bin/duplicity", line 1375, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py", line 1126, in ProcessCommandLine
    backup, local_pathname = set_backend(args[0], args[1])
  File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py", line 1015, in set_backend
    globals.backend = backend.get_backend(bend)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 209, in get_backend_object
    return factory(pu)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py", line 90, in __init__
    self.initialize_oauth2_session()
  File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py", line 127, in initialize_oauth2_session
    self.http_client.refresh_token(self.OAUTH_TOKEN_URI)
  File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 298, in refresh_token
    timeout=timeout, headers=headers, verify=verify, withhold_token=True, proxies=proxies)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 358, in request
    headers=headers, data=data, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 330, in connect
    cert = self.sock.getpeercert()
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 324, in getpeercert
    'subjectAltName': get_subj_alt_name(x509)
  File "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 171, in get_subj_alt_name...

Read more...

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :
Download full text (5.0 KiB)

Hmmm, this is what I get. You got past the includes and into
initialize_oauth2_session.
 Perhaps your ~/.duplicity_onedrive_oauthtoken.json exists and is corrupt?

...Ken

ken@dione:~/workspace/duplicity-src7$ duplicity full ~/workspace
onedrive://testdup
Could not load OAuth2 token. Trying to create a new one. (original error:
[Errno 2] No such file or directory:
'/Users/ken/.duplicity_onedrive_oauthtoken.json')
()
In order to authorize duplicity to access your OneDrive, please open
https://login.live.com/oauth20_authorize.srf?<snip> in a browser and copy
the URL of the blank page the dialog leads to.
()
URL of the blank page:

On Fri, Jan 27, 2017 at 11:34 AM, Walter <email address hidden> wrote:

> Now I got the following:
>
> /usr/local/bin/duplicity --allow-source-mismatch --volsize 5
> --exclude-filelist /Users/walter/Work/Scripts/nonsynclist.txt
> --include-filelist /Users/walter/Work/Scripts/synclist.txt --exclude '**'
> /Users/walter/Work onedrive://Sync
> Traceback (most recent call last):
> File "/usr/local/bin/duplicity", line 1546, in <module>
> with_tempdir(main)
> File "/usr/local/bin/duplicity", line 1540, in with_tempdir
> fn()
> File "/usr/local/bin/duplicity", line 1375, in main
> action = commandline.ProcessCommandLine(sys.argv[1:])
> File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py",
> line 1126, in ProcessCommandLine
> backup, local_pathname = set_backend(args[0], args[1])
> File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py",
> line 1015, in set_backend
> globals.backend = backend.get_backend(bend)
> File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py",
> line 223, in get_backend
> obj = get_backend_object(url_string)
> File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py",
> line 209, in get_backend_object
> return factory(pu)
> File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py",
> line 90, in __init__
> self.initialize_oauth2_session()
> File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py",
> line 127, in initialize_oauth2_session
> self.http_client.refresh_token(self.OAUTH_TOKEN_URI)
> File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py",
> line 298, in refresh_token
> timeout=timeout, headers=headers, verify=verify, withhold_token=True,
> proxies=proxies)
> File "/usr/local/lib/python2.7/site-packages/requests/sessions.py",
> line 535, in post
> return self.request('POST', url, data=data, json=json, **kwargs)
> File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py",
> line 358, in request
> headers=headers, data=data, **kwargs)
> File "/usr/local/lib/python2.7/site-packages/requests/sessions.py",
> line 488, in request
> resp = self.send(prep, **send_kwargs)
> File "/usr/local/lib/python2.7/site-packages/requests/sessions.py",
> line 609, in send
> r = adapter.send(request, **kwargs)
> File "/usr/local/lib/python2.7/site-packages/requests/adapters.py",
> line 423, in send
> timeout=timeout
> File "/usr/local/lib/python2.7/site-packages...

Read more...

Revision history for this message
Walter (wmaldonado) wrote :

$ rm .duplicity_onedrive_oauthtoken.json
$ /usr/local/bin/duplicity --allow-source-mismatch --volsize 5 --exclude-filelist /Users/walter/Work/Scripts/nonsynclist.txt --include-filelist /Users/walter/Work/Scripts/synclist.txt --exclude '**' /Users/walter/Work onedrive://Sync

Could not load OAuth2 token. Trying to create a new one. (original error: [Errno 2] No such file or directory: '/Users/walter/.duplicity_onedrive_oauthtoken.json')
/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py:337: SubjectAltNameWarning: Certificate for apis.live.net has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
  SubjectAltNameWarning
Traceback (most recent call last):
  File "/usr/local/bin/duplicity", line 1546, in <module>
    with_tempdir(main)
  File "/usr/local/bin/duplicity", line 1540, in with_tempdir
    fn()
  File "/usr/local/bin/duplicity", line 1375, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py", line 1126, in ProcessCommandLine
    backup, local_pathname = set_backend(args[0], args[1])
  File "/usr/local/lib/python2.7/site-packages/duplicity/commandline.py", line 1015, in set_backend
    globals.backend = backend.get_backend(bend)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backend.py", line 209, in get_backend_object
    return factory(pu)
  File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py", line 90, in __init__
    self.initialize_oauth2_session()
  File "/usr/local/lib/python2.7/site-packages/duplicity/backends/onedrivebackend.py", line 133, in initialize_oauth2_session
    user_info_response = self.http_client.get(self.API_URI + 'me')
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 358, in request
    headers=headers, data=data, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
SSLError: hostname 'apis.live.net' doesn't match u'storage.live.com'

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Looks like MS has a problem with their certs. Now to figure out how to turn off cert verify.

Changed in duplicity:
status: Fix Released → In Progress
Revision history for this message
Walter (wmaldonado) wrote :

I have duplicity running on a CentOS server flawlessly. It may be useful information:

[root@pimentel ~]# duplicity -V
duplicity 0.7.05
[root@pimentel ~]# cat /etc/centos-release
CentOS release 6.7 (Final)

Changed in duplicity:
milestone: 0.7.12 → 0.7.13
Changed in duplicity:
milestone: 0.7.13 → 0.7.14
assignee: nobody → Kenneth Loafman (kenneth-loafman)
Changed in duplicity:
milestone: 0.7.13.1 → 0.7.14
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Is this problem still happening? I cannot reproduce at all.

Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
milestone: 0.7.14 → none
status: In Progress → Incomplete
Revision history for this message
Walter (wmaldonado) wrote :

I made a clean install in my mac and now it is working. Version tested 0.7.13.1.
You can close this thread, thank you for your assistance.

Changed in duplicity:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.