pinterest/knox

Python Client

MadSpindel opened this issue · 3 comments

In Wiki page about Knox Client:

At Pinterest we have knox clients written in many languages

I guess you have a Python client? Is this something you are considering to open source? Otherwise I have to build it myself 😄

I'm looking into how much work it would be to remove internal dependencies/oddities, but I think there is a few that would be tough to change. I definitely encourage you to make your own though. What we use is very similar to the Go NewFileClient (https://github.com/pinterest/knox/blob/master/client.go#L30). It runs "knox register" and "knox get" with the KNOX_MACHINE_AUTH variable set and then checks the file every n seconds for updates.

I see. I will try to make my own. Thank you!

@devinlundberg Could you provide a Python example how ACL request should look like? I really don't understand how Go is making the ACL look like in the json request. Actually I don't understand Go at all since I am new to that programming language ;)

I got this error:

cannot unmarshal object into Go value of type knox.ACL

Nvm, I got this to work:

acl = json.dumps([{
    'type': "User",
    'access': "Admin",
    'id': "MadSpindel"
}])