Hi,

I need to store some third party server passwords in Django, in views.py to 
be more specific. Those are used for Paramiko SFTP (machine-to-machine 
communication) and it's not possible to use keys instead of passwords. For 
sure I don't like to write those passwords directly to source code. I have 
figured out that Python Keyring would be good way to store passwords and 
following short code works ok: 

import keyring
try:
    keyring.get_keyring()
    keyring.set_password("system", "user", "passWORD")
    pword = keyring.get_password("system", "user")
    print pword
except Exception as e:
    print e  

I moved the code to Django (views.py):


from django.http import HttpResponse
import keyring
def index(request):
    try:
        keyring.get_keyring()
        keyring.set_password("system", "user", "passWORD")
        pword = keyring.get_password("system", "user")
        return HttpResponse(pword)

    except Exception as e:
        return HttpResponse(e)


Then I asked Django to run built-in development server by typing: sudo 
python manage.py runserver

Finally I browsed to correct localhost url. Result: browser was showing 
dialog requesting me to create (on first try) and then open (on next tries 
after I have created it) kdewallet.

Is it possible to use Keyring from Django without need for user interaction 
(= without those dialogs)? in the other words: how to configure Keyring to 
be used with Django?


Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/85dd1093-6f54-4aea-b8ff-d48e67b54942%40googlegroups.com.

Reply via email to