Giter VIP home page Giter VIP logo

Comments (3)

nkzawa avatar nkzawa commented on April 28, 2024

It doesn't check the master key and accepts any value, so I think there is another problem. Can you share the code and/or error logs if possible?

from cosmosdb-server.

renato04 avatar renato04 commented on April 28, 2024

Hello!

Here it is my code

from pydocumentdb import document_client

client = document_client.DocumentClient(
    'https://localhost:3000/', {'masterKey': 'test key'})

print("creating database")
db = client.CreateDatabase({'id': 'test_database'})

print("creating collection")
collection = client.CreateCollection(
    db['_self'], {'id': 'my_collection'})

input()

And here it is the exception log

C:\Users\Renato\repos\bliive-api-python\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 51549 --file C:/Users/Renato/repos/bliive-api-python/api_local.py
pydev debugger: process 20748 is connecting

Connected to pydev debugger (build 191.7479.30)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py", line 1758, in <module>
creating database
    main()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py", line 1752, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\pydevd.py", line 1147, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Renato/repos/bliive-api-python/api_local.py", line 7, in <module>
    db = client.CreateDatabase({'id': 'test_database'})
  File "C:\Users\Renato\repos\bliive-api-python\venv\lib\site-packages\pydocumentdb\document_client.py", line 213, in CreateDatabase
    return self.Create(database, path, 'dbs', None, None, options)
  File "C:\Users\Renato\repos\bliive-api-python\venv\lib\site-packages\pydocumentdb\document_client.py", line 2130, in Create
    options)
  File "C:\Users\Renato\repos\bliive-api-python\venv\lib\site-packages\pydocumentdb\base.py", line 168, in GetHeaders
    headers)
  File "C:\Users\Renato\repos\bliive-api-python\venv\lib\site-packages\pydocumentdb\auth.py", line 56, in GetAuthorizationHeader
    document_client.master_key)
  File "C:\Users\Renato\repos\bliive-api-python\venv\lib\site-packages\pydocumentdb\auth.py", line 85, in __GetAuthorizationTokenUsingMasterKey
    key = base64.b64decode(master_key)
  File "C:\Python36\lib\base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Thanks

from cosmosdb-server.

renato04 avatar renato04 commented on April 28, 2024

I put no key and it worked

client = document_client.DocumentClient( 'https://localhost:3000/', {'masterKey': ''})

Thank you @nkzawa

from cosmosdb-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.