Hi,

Thanks for answer!

It may be overkill, but it seems so easy/useful from plain Python (test I 
did). I will probably head to env variants as it seems to be popular way to 
achieve what I'm trying.

lauantai 12. lokakuuta 2019 10.05.07 UTC+3 Tumbelo kirjoitti:
>
> 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/45183b59-987c-4a4d-9ee6-e62a6a651cba%40googlegroups.com.

Reply via email to