Commit 01447972 authored by Michael Fladischer's avatar Michael Fladischer

Import Upstream version 8.0.0

parents
Copyright (c) 2015-2017 Dropbox Inc., http://www.dropbox.com/
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.
include ez_setup.py
include LICENSE
include *.rst
include test/requirements.txt
Metadata-Version: 1.1
Name: dropbox
Version: 8.0.0
Summary: Official Dropbox API Client
Home-page: http://www.dropbox.com/developers
Author: Dropbox
Author-email: dev-platform@dropbox.com
License: MIT License
Description: Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.0.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
:target: https://dropbox-sdk-python.readthedocs.org/en/stable/
:alt: [Latest Release Documentation]
.. image:: https://img.shields.io/pypi/v/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Version]
.. image:: https://img.shields.io/pypi/l/dropbox.svg
:target: http://opensource.org/licenses/MIT
:alt: [Latest Release License]
.. image:: https://img.shields.io/pypi/pyversions/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Versions]
.. image:: https://img.shields.io/pypi/implementation/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Implementations]
.. image:: https://img.shields.io/pypi/status/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Development Stage]
A Python SDK for integrating with the Dropbox API v2. Compatible with Python
2.7 and 3.4+. Documentation is available on `Read the Docs
<http://dropbox-sdk-python.readthedocs.org/>`_.
Installation
------------
Install via ``pip``:
.. code-block:: console
$ pip install dropbox
Install from source:
.. code-block:: console
$ git clone git://github.com/dropbox/dropbox-sdk-python.git
$ cd dropbox-sdk-python
$ python setup.py install
After installation, to get started, open a Python console:
.. code-block:: pycon
>>> import dropbox
>>> dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
>>> dbx.users_get_current_account()
Creating an Application
-----------------------
You need to create an Dropbox Application to make API requests.
- Go to https://dropbox.com/developers/apps.
Obtaining an Access Token
-------------------------
All requests need to be made with an OAuth 2 access token. To get started, once
you've created an app, you can go to the app's console and generate an access
token for your own Dropbox account.
Examples
--------
``example/updown.py`` demonstrates how to sync a local directory with a Dropbox.
Documentation
-------------
Documentation can be compiled by running ``make html`` from the ``docs``
folder. After compilation, open ``docs/_build/html/index.html``. Alternatively,
you can read a hosted version from `Read the Docs`_.
Updating API specification
--------------------------
A good amount of this SDK is generated using `Stone
<https://www.github.com/dropbox/stone>`_. We use git submodules to pin to a
specific version of `Stone` since it's under active development, and we also
pin to a version of our `API spec
<https://www.github.com/dropbox/dropbox-api-spec>`_.
To prepare the repo for generation, run these commands after cloning:
.. code-block:: console
$ git submodule init
$ git submodule update
You can run ``git pull`` within these sub repositories to update the pinned
version.
Now, run the included script:
.. code-block:: console
$ ./generate_base_client.py
Testing
-------
We use the `tox <https://tox.readthedocs.org/>`_ package to run tests in Python
2 and 3. To install, use :code:`pip install tox`. Once installed, run `tox` from the
root directory. You'll need to specify a working Dropbox OAuth2 token:
.. code-block:: console
$ DROPBOX_TOKEN=YOUR_TOKEN tox -- -k "'not test_team'"
Note that we skip ``test_team`` which requires a team token with `Member File Access
<https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access>`_.
To test this functionality, specify a ``DROPBOX_TEAM_TOKEN`` environment
variable.
.. code-block:: console
$ DROPBOX_TOKEN=... DROPBOX_TEAM_TOKEN=... tox
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.0.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
:target: https://dropbox-sdk-python.readthedocs.org/en/stable/
:alt: [Latest Release Documentation]
.. image:: https://img.shields.io/pypi/v/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Version]
.. image:: https://img.shields.io/pypi/l/dropbox.svg
:target: http://opensource.org/licenses/MIT
:alt: [Latest Release License]
.. image:: https://img.shields.io/pypi/pyversions/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Versions]
.. image:: https://img.shields.io/pypi/implementation/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Implementations]
.. image:: https://img.shields.io/pypi/status/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Development Stage]
A Python SDK for integrating with the Dropbox API v2. Compatible with Python
2.7 and 3.4+. Documentation is available on `Read the Docs
<http://dropbox-sdk-python.readthedocs.org/>`_.
Installation
------------
Install via ``pip``:
.. code-block:: console
$ pip install dropbox
Install from source:
.. code-block:: console
$ git clone git://github.com/dropbox/dropbox-sdk-python.git
$ cd dropbox-sdk-python
$ python setup.py install
After installation, to get started, open a Python console:
.. code-block:: pycon
>>> import dropbox
>>> dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
>>> dbx.users_get_current_account()
Creating an Application
-----------------------
You need to create an Dropbox Application to make API requests.
- Go to https://dropbox.com/developers/apps.
Obtaining an Access Token
-------------------------
All requests need to be made with an OAuth 2 access token. To get started, once
you've created an app, you can go to the app's console and generate an access
token for your own Dropbox account.
Examples
--------
``example/updown.py`` demonstrates how to sync a local directory with a Dropbox.
Documentation
-------------
Documentation can be compiled by running ``make html`` from the ``docs``
folder. After compilation, open ``docs/_build/html/index.html``. Alternatively,
you can read a hosted version from `Read the Docs`_.
Updating API specification
--------------------------
A good amount of this SDK is generated using `Stone
<https://www.github.com/dropbox/stone>`_. We use git submodules to pin to a
specific version of `Stone` since it's under active development, and we also
pin to a version of our `API spec
<https://www.github.com/dropbox/dropbox-api-spec>`_.
To prepare the repo for generation, run these commands after cloning:
.. code-block:: console
$ git submodule init
$ git submodule update
You can run ``git pull`` within these sub repositories to update the pinned
version.
Now, run the included script:
.. code-block:: console
$ ./generate_base_client.py
Testing
-------
We use the `tox <https://tox.readthedocs.org/>`_ package to run tests in Python
2 and 3. To install, use :code:`pip install tox`. Once installed, run `tox` from the
root directory. You'll need to specify a working Dropbox OAuth2 token:
.. code-block:: console
$ DROPBOX_TOKEN=YOUR_TOKEN tox -- -k "'not test_team'"
Note that we skip ``test_team`` which requires a team token with `Member File Access
<https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access>`_.
To test this functionality, specify a ``DROPBOX_TEAM_TOKEN`` environment
variable.
.. code-block:: console
$ DROPBOX_TOKEN=... DROPBOX_TEAM_TOKEN=... tox
Metadata-Version: 1.1
Name: dropbox
Version: 8.0.0
Summary: Official Dropbox API Client
Home-page: http://www.dropbox.com/developers
Author: Dropbox
Author-email: dev-platform@dropbox.com
License: MIT License
Description: Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.0.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
:target: https://dropbox-sdk-python.readthedocs.org/en/stable/
:alt: [Latest Release Documentation]
.. image:: https://img.shields.io/pypi/v/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Version]
.. image:: https://img.shields.io/pypi/l/dropbox.svg
:target: http://opensource.org/licenses/MIT
:alt: [Latest Release License]
.. image:: https://img.shields.io/pypi/pyversions/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Versions]
.. image:: https://img.shields.io/pypi/implementation/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Supported Python Implementations]
.. image:: https://img.shields.io/pypi/status/dropbox.svg
:target: https://pypi.python.org/pypi/dropbox
:alt: [Latest Release Development Stage]
A Python SDK for integrating with the Dropbox API v2. Compatible with Python
2.7 and 3.4+. Documentation is available on `Read the Docs
<http://dropbox-sdk-python.readthedocs.org/>`_.
Installation
------------
Install via ``pip``:
.. code-block:: console
$ pip install dropbox
Install from source:
.. code-block:: console
$ git clone git://github.com/dropbox/dropbox-sdk-python.git
$ cd dropbox-sdk-python
$ python setup.py install
After installation, to get started, open a Python console:
.. code-block:: pycon
>>> import dropbox
>>> dbx = dropbox.Dropbox("YOUR_ACCESS_TOKEN")
>>> dbx.users_get_current_account()
Creating an Application
-----------------------
You need to create an Dropbox Application to make API requests.
- Go to https://dropbox.com/developers/apps.
Obtaining an Access Token
-------------------------
All requests need to be made with an OAuth 2 access token. To get started, once
you've created an app, you can go to the app's console and generate an access
token for your own Dropbox account.
Examples
--------
``example/updown.py`` demonstrates how to sync a local directory with a Dropbox.
Documentation
-------------
Documentation can be compiled by running ``make html`` from the ``docs``
folder. After compilation, open ``docs/_build/html/index.html``. Alternatively,
you can read a hosted version from `Read the Docs`_.
Updating API specification
--------------------------
A good amount of this SDK is generated using `Stone
<https://www.github.com/dropbox/stone>`_. We use git submodules to pin to a
specific version of `Stone` since it's under active development, and we also
pin to a version of our `API spec
<https://www.github.com/dropbox/dropbox-api-spec>`_.
To prepare the repo for generation, run these commands after cloning:
.. code-block:: console
$ git submodule init
$ git submodule update
You can run ``git pull`` within these sub repositories to update the pinned
version.
Now, run the included script:
.. code-block:: console
$ ./generate_base_client.py
Testing
-------
We use the `tox <https://tox.readthedocs.org/>`_ package to run tests in Python
2 and 3. To install, use :code:`pip install tox`. Once installed, run `tox` from the
root directory. You'll need to specify a working Dropbox OAuth2 token:
.. code-block:: console
$ DROPBOX_TOKEN=YOUR_TOKEN tox -- -k "'not test_team'"
Note that we skip ``test_team`` which requires a team token with `Member File Access
<https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access>`_.
To test this functionality, specify a ``DROPBOX_TEAM_TOKEN`` environment
variable.
.. code-block:: console
$ DROPBOX_TOKEN=... DROPBOX_TEAM_TOKEN=... tox
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
LICENSE
MANIFEST.in
README.rst
ez_setup.py
setup.cfg
setup.py
dropbox/__init__.py
dropbox/async.py
dropbox/auth.py
dropbox/base.py
dropbox/base_team.py
dropbox/common.py
dropbox/dropbox.py
dropbox/exceptions.py
dropbox/files.py
dropbox/oauth.py
dropbox/paper.py
dropbox/properties.py
dropbox/session.py
dropbox/sharing.py
dropbox/stone_base.py
dropbox/stone_serializers.py
dropbox/stone_validators.py
dropbox/team.py
dropbox/team_common.py
dropbox/team_log.py
dropbox/team_policies.py
dropbox/trusted-certs.crt
dropbox/users.py
dropbox/users_common.py
dropbox.egg-info/PKG-INFO
dropbox.egg-info/SOURCES.txt
dropbox.egg-info/dependency_links.txt
dropbox.egg-info/not-zip-safe
dropbox.egg-info/requires.txt
dropbox.egg-info/top_level.txt
test/requirements.txt
test/test_dropbox.py
\ No newline at end of file
requests >= 2.5.1, != 2.6.1, !=2.16.0, !=2.16.1
six >= 1.3.0
urllib3
from __future__ import absolute_import
from .dropbox import __version__, Dropbox, DropboxTeam, create_session # noqa: F401
from .oauth import DropboxOAuth2Flow, DropboxOAuth2FlowNoRedirect # noqa: F401
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# flake8: noqa
# pylint: skip-file
try:
from . import stone_validators as bv
from . import stone_base as bb
except (SystemError, ValueError):
# Catch errors raised when importing a relative module when not in a package.
# This makes testing this file directly (outside of a package) easier.
import stone_validators as bv
import stone_base as bb
class LaunchResultBase(bb.Union):
"""
Result returned by methods that launch an asynchronous job. A method who may
either launch an asynchronous job, or complete the request synchronously,
can use this union by extending it, and adding a 'complete' field with the
type of the synchronous response. See :class:`LaunchEmptyResult` for an
example.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar str async_job_id: This response indicates that the processing is
asynchronous. The string is an id that can be used to obtain the status
of the asynchronous job.
"""
_catch_all = None
@classmethod
def async_job_id(cls, val):
"""
Create an instance of this class set to the ``async_job_id`` tag with
value ``val``.
:param str val:
:rtype: LaunchResultBase
"""
return cls('async_job_id', val)
def is_async_job_id(self):
"""
Check if the union tag is ``async_job_id``.
:rtype: bool
"""
return self._tag == 'async_job_id'
def get_async_job_id(self):
"""
This response indicates that the processing is asynchronous. The string
is an id that can be used to obtain the status of the asynchronous job.
Only call this if :meth:`is_async_job_id` is true.
:rtype: str
"""
if not self.is_async_job_id():
raise AttributeError("tag 'async_job_id' not set")
return self._value
def __repr__(self):
return 'LaunchResultBase(%r, %r)' % (self._tag, self._value)
LaunchResultBase_validator = bv.Union(LaunchResultBase)
class LaunchEmptyResult(LaunchResultBase):
"""
Result returned by methods that may either launch an asynchronous job or
complete synchronously. Upon synchronous completion of the job, no
additional information is returned.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar complete: The job finished synchronously and successfully.
"""
# Attribute is overwritten below the class definition
complete = None
def is_complete(self):
"""
Check if the union tag is ``complete``.
:rtype: bool
"""
return self._tag == 'complete'
def __repr__(self):
return 'LaunchEmptyResult(%r, %r)' % (self._tag, self._value)
LaunchEmptyResult_validator = bv.Union(LaunchEmptyResult)
class PollArg(object):
"""
Arguments for methods that poll the status of an asynchronous job.
:ivar async_job_id: Id of the asynchronous job. This is the value of a
response returned from the method that launched the job.
"""
__slots__ = [
'_async_job_id_value',
'_async_job_id_present',
]
_has_required_fields = True
def __init__(self,
async_job_id=None):
self._async_job_id_value = None
self._async_job_id_present = False
if async_job_id is not None:
self.async_job_id = async_job_id
@property
def async_job_id(self):
"""
Id of the asynchronous job. This is the value of a response returned
from the method that launched the job.
:rtype: str
"""
if self._async_job_id_present:
return self._async_job_id_value
else:
raise AttributeError("missing required field 'async_job_id'")
@async_job_id.setter
def async_job_id(self, val):
val = self._async_job_id_validator.validate(val)
self._async_job_id_value = val
self._async_job_id_present = True
@async_job_id.deleter
def async_job_id(self):
self._async_job_id_value = None
self._async_job_id_present = False
def __repr__(self):
return 'PollArg(async_job_id={!r})'.format(
self._async_job_id_value,
)
PollArg_validator = bv.Struct(PollArg)
class PollResultBase(bb.Union):
"""
Result returned by methods that poll for the status of an asynchronous job.
Unions that extend this union should add a 'complete' field with a type of
the information returned upon job completion. See :class:`PollEmptyResult`
for an example.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar in_progress: The asynchronous job is still in progress.
"""
_catch_all = None
# Attribute is overwritten below the class definition
in_progress = None
def is_in_progress(self):
"""
Check if the union tag is ``in_progress``.
:rtype: bool
"""
return self._tag == 'in_progress'
def __repr__(self):
return 'PollResultBase(%r, %r)' % (self._tag, self._value)
PollResultBase_validator = bv.Union(PollResultBase)
class PollEmptyResult(PollResultBase):
"""
Result returned by methods that poll for the status of an asynchronous job.
Upon completion of the job, no additional information is returned.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar complete: The asynchronous job has completed successfully.
"""
# Attribute is overwritten below the class definition
complete = None
def is_complete(self):
"""
Check if the union tag is ``complete``.
:rtype: bool
"""
return self._tag == 'complete'
def __repr__(self):
return 'PollEmptyResult(%r, %r)' % (self._tag, self._value)
PollEmptyResult_validator = bv.Union(PollEmptyResult)
class PollError(bb.Union):
"""
Error returned by methods for polling the status of asynchronous job.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar invalid_async_job_id: The job ID is invalid.
:ivar internal_error: Something went wrong with the job on Dropbox's end.
You'll need to verify that the action you were taking succeeded, and if
not, try again. This should happen very rarely.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
invalid_async_job_id = None
# Attribute is overwritten below the class definition
internal_error = None
# Attribute is overwritten below the class definition
other = None
def is_invalid_async_job_id(self):
"""
Check if the union tag is ``invalid_async_job_id``.
:rtype: bool
"""
return self._tag == 'invalid_async_job_id'
def is_internal_error(self):
"""
Check if the union tag is ``internal_error``.
:rtype: bool
"""
return self._tag == 'internal_error'
def is_other(self):
"""