Problem following API example

New post

Comments

2 comments

  • Anna34

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

    1
    Comment actions Permalink
  • MarkWEQ

    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)

     

    0
    Comment actions Permalink

Please sign in to leave a comment.