title: Python's urllib2.urlopen() hanging with local connection to a Java Restlet server
body: <p>I'm trying to connect to a local running Restlet server from python, but the connection hangs infinitely (or times out if I set a timeout).</p>
  
  <pre><code>import urllib2
  handle = urllib2.urlopen("http://localhost:8182/contact/123") # hangs
  </code></pre>
  
  <p>If I use <code>curl</code> from a shell to open the above URL, the results return quickly.  If I use urllib2 to open a different local service (e.g. a Django web server on port 8000), urllib2 works fine.  </p>
  
  <p>I've tried disabling firewall (I'm doing this on OS X).  I've tried changing localhost to 127.0.0.1.  The logs from Restlet for both the curl and urllib2 connection appear the same aside from the user-agent.  </p>
  
  <p>My workaround would be to just call <code>curl</code> via <code>subprocess</code>, but I'd rather understand why this is failing.</p>
  
  <p>Here's how my Restlet Resource looks:</p>
  
  <pre><code>public class ContactResource extends ServerResource {
  
    @Get
    public String represent() throws Exception {
      return "&lt;contact details&gt;";
    }
    //....
  }
  </code></pre>
  
  <p>Let me know if you want more info/code</p>