python - How to cache username and passwd in pysvn -


here code

#!/usr/bin/python # -*- coding:utf-8 -*- import sys import pysvn def main():     client = pysvn.client()     client.callback_get_login = lambda realm, username, may_save:(true, "myusername", "mypasswd", true)     print client.cat('http://svn.mydomain.com/file1.py')     print client.cat('http://svn.mydomain.com/file2.py')     return 0  if __name__ == "__main__":     sys.exit(main()) 

and noticed pysvn established 2 http sessions, in each session, first tried option method without "authorization" header, after server response 401, sent "authorization" header.

since 2 url in same domain, why not pysvn send username/passwd directly in subsequence sessions?

i have question because i'm suspecting 401 made svn server failed response. , svnkit in eclipse works fine , send "authorization" header automatic.

edit: alex martelli:

try passing explicit path known-to-be-writable config dir when call client.

tried, not work

it may serving sending different realms 2 files

the realms of 2 response same.

it looks pysvn calls "svn_client_cat2()" libsvn , function not cache username/passwd between invoking same url , same realms. don't think can more problem, adding new interface libsvn , cache username/passwd future actions cost time task. anyway!

looks (bug hypothesis number one) configuration directory might not writable -- try passing explicit path known-to-be-writable config dir when call client.

if doesn't (bug hypothesis number two) may serving sending different realms 2 files (the fact it's same domain doesn't stop server doing that, though peculiar configuration choice or configuration error on server's part... server fails due "too many 401s" have peculiar anyway, it's suspect already;-).


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -