box-python-sdk
Installing
pip install boxsdk
Usage
Get user info
me = client.user(user_id='me').get()
print 'user_login: ' + me['login']
Get folder info
root_folder = client.folder(folder_id='0').get()
print 'folder owner: ' + root_folder.owned_by['login']
print 'folder name: ' + root_folder['name']
Get items in a folder
items = client.folder(folder_id='0').get_items(limit=100, offset=0)
Create subfolder
# creates folder structure /L1/L2/L3
client.folder(folder_id='0').create_subfolder('L1').create_subfolder('L2').create_subfolder('L3')
Get file name
client.file(file_id='SOME_FILE_ID').get()['name']
Rename an item
client.file(file_id='SOME_FILE_ID').rename('bar-2.txt')
Move an item
client.file(file_id='SOME_FILE_ID').move(client.folder(folder_id='SOME_FOLDER_ID'))
Get content of a file
client.file(file_id='SOME_FILE_ID').content()
Lock/unlock a file
client.file(file_id='SOME_FILE_ID').lock()
client.file(file_id='SOME_FILE_ID').unlock()
Search
client.search('some_query', limit=100, offset=0)
Events
# Get events
client.events().get_events(limit=100, stream_position='now')
# Generate events using long polling
for event in client.events().generate_events_with_long_polling():
pass # Do something with the event
# Get latest stream position
client.events().get_latest_stream_position()
Metadata
# Get metadata
client.file(file_id='SOME_FILE_ID').metadata().get()
# Create metadata
client.file(file_id='SOME_FILE_ID').metadata().create({'key': 'value'})
# Update metadata
metadata = client.file(file_id='SOME_FILE_ID').metadata()
update = metadata.start_update()
update.add('/key', 'new_value')
metadata.update(update)
Contributing
See CONTRIBUTING.rst.
Developer Setup
Create a virtual environment and install packages -
mkvirtualenv boxsdk
pip install -r requirements-dev.txt
Testing
Run all tests using -
tox
The tox tests include code style checks via pep8 and pylint.
The tox tests are configured to run on Python 2.6, 2.7, 3.3, 3.4, and PyPy.
Support
Need to contact us directly? Email oss@box.com and be sure to include the name of this project in the subject. For questions, please contact us directly rather than opening an issue.
Copyright and License
Copyright 2015 Box, Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Metadata
Release files for boxsdk 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boxsdk-1.1.4.tar.gz | 64.1 kB | Without provenance | Details for boxsdk-1.1.4.tar.gz |
Release files / boxsdk-1.1.4.tar.gz
| Download URL | boxsdk-1.1.4.tar.gz |
|---|---|
| Size | 64.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83444669d7581f4cebb0d52f6853cd87d0518d1f659decf9bc1779034274c971
|
|
BLAKE2b-256 checksum How to use checksums |
b22507ae43c0bdaed1c540d1d04dacdb531a80e7aa357b26c90a43bf65e583b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for boxsdk 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.