The Mendeley Python SDK provides access to the Mendeley API. For more information on the API and its capabilities, see the Mendeley developer portal.
You might like to set up a virtualenv for your project that uses the Mendeley API. See this virtualenv tutorial for instructions. IDEs like IntelliJ with the Python plugin or PyCharm can also help you manage a virtualenv.
Install dependencies from PyPI using pip, a package manager for Python.
pip install mendeley
Full documentation, including examples, can be found on ReadTheDocs.
See the Travis CI build to find:
Travis CI automatically pushes new releases to Pypi, and triggers ReadTheDocs rebuilds, if the following conditions are true:
git tag v1.2.3
and then git push --tags
)See the .travis.yml 'deploy' section for more specific information.
pip install -r requirements.txt
Run the test suite to see if your changes worked. If you are using a virtualenv, consider using tox
. If not, the good old py.test
command also works.
Set the Mendeley API client ID and secret as environment variables in your shell:
export MENDELEY_CLIENT_ID=[your app client ID]
export MENDELEY_CLIENT_SECRET=[your app client secret]
Create a test user account that you can safely make a mess inside. WARNING: Our user flow test suite exercises the API as a particular Mendeley user. The suite contains tests that will delete all documents associated with that account. Do not use your personal Mendeley account!
Set the necessary extra credentials:
export MENDELEY_ACCESS_TOKEN=[user's access token]
export MENDELEY_REDIRECT_URI=[redirect URI of your app]
Turn on the VCR cache (if you like) by setting recordMode: once
in the test config YAML file.
Run all tests in the test suite:
py.test
In the CI environment, it is not (yet) possible to test interactions with API endpoints that require user access tokens. We can only exercise tests that use the client credentials flow. You must put any tests which CI cannot run in the test/manual folder, so that the CI test run command can ignore them.
recordMode: all
the test config YAML file.Run the test suite ignoring 'user mode' tests that require user access tokens:
py.test --ignore=test/manual/