title: How to cache username and passwd in pysvn
body: <p>here is my code</p>
  
  <pre><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())
  </code></pre>
  
  <p>and I noticed that pysvn established two HTTP sessions, but in each session, it first tried a OPTION method without the "Authorization" header, after the server response 401, it sent "Authorization" header.</p>
  
  <p>Since the two url is in the same domain, why not pysvn send the username/passwd directly in the subsequence sessions?</p>
  
  <p>I have this question because I'm suspecting that too much 401 made my svn server failed to response. And the svnkit in eclipse works just fine and send "Authorization" header automatic.</p>
  
  <p>Edit:
  to Alex Martelli:</p>
  
  <blockquote>
    <p>try passing an explicit path to a known-to-be-writable config dir when you call Client.</p>
  </blockquote>
  
  <p>tried, not work</p>
  
  <blockquote>
    <p>it may be that the serving is sending different realms for the two files</p>
  </blockquote>
  
  <p>the realms of two response is the same.</p>
  
  <p>It looks like pysvn calls "svn_client_cat2()" from libsvn and this function does not cache username/passwd between invoking even for the same url and same realms.
  So I don't think I can do any more to this problem, adding new interface to libsvn and cache username/passwd for future actions will cost too much time for my task. Thanks anyway!</p>