Skip to main content
Question

Problem following API example

  • May 22, 2025
  • 2 replies
  • 22 views

Forum|alt.badge.img

I am following examples in https://github.com/box/box-python-sdk and I have the simple examples under "Getting Strarted" working, using the tokens I got from generating an app with Oauth2.0 with JWT.

I then tried to run the example in http://opensource.box.com/box-python-sdk/tutorials/intro.html and at the line "my = client.user(user_id='me').get()" I get an error:
AttributeError: 'LoggingNetwork' object has no attribute 'translator'

It looks like there should be an attribute in the base class that isn't there.

I tried using my box account user name instead of "my" to no avail.

I installed boxdev today, 13-Dec_2018, python 2.7.12, Ubuntu 16.04

2 replies

Forum|alt.badge.img

I have the same problem! Any solution would be much appreciated


Forum|alt.badge.img

I ended up working around the problem. I went back to the example in https://github.com/box/box-python-sdk/blob/master/README.rst#getting-started , under "Outside of a REPL". That much I had working already. Then I went to the python api documentation here: https://box-python-sdk.readthedocs.io/en/latest/boxsdk.html . And I wrote my own simple upload script, which works for me:

 

#!/usr/bin/python

from boxsdk import OAuth2, Client

 

auth = OAuth2(
  client_id='my_client_id',
  client_secret='my_client_secret',
  access_token='my_access_token',
)


client = Client(auth)

 

user = client.user().get()

 

root_folder = client.folder(folder_id='0').get()
folder_items = root_folder.get_items(limit=100,offset=0)
for folder_item in folder_items:
  if folder_item['name'] == 'myfolder' :
   folder = client.folder(folder_item['id']).get()
   break

 

# do 2 files
file_list = ['file1','file2']
for file_name in file_list :
  box_file = folder.upload(file_path=file_name)