title: Calling a REST service with Python
body: <p>I have a REST service that I'm trying to call. It requires something similar to the following syntax:</p>
  
  <pre><code>http://someServerName:8080/projectName/service/serviceName/
        param1Name/param1/param2Name/param2
  </code></pre>
  
  <p>I have to connect to it using POST. I've tried reading up on it online (<a href="http://developer.yahoo.com/python/python-rest.html" rel="nofollow noreferrer">here</a> and <a href="http://www.ebi.ac.uk/Tools/webservices/tutorials/06_programming/python/rest/urllib#http_post" rel="nofollow noreferrer">here</a>, for example)... but this is my problem:</p>
  
  <p>If I try using the HTTP get request method, by building my own path, like this:</p>
  
  <pre><code>BASE_PATH = "http://someServerName:8080/projectName/service/serviceName/"
  urllib.urlopen(BASE_PATH + "param1/" + param1 + "/param2/" + param2)
  </code></pre>
  
  <p>it gives me an error saying that GET is not allowed.</p>
  
  <p>If I try using the HTTP post request method, like this:</p>
  
  <pre><code>params = { "param1" : param1, "param2" : param2 }
  urllib.urlopen(BASE_PATH, urllib.urlencode(params))
  </code></pre>
  
  <p>it returns a 404 error along with the message <code>The requested resource () is not available.</code> And when I debug this, it seems to be building the params into a query string ("param1=whatever&amp;param2=whatever"...)</p>
  
  <p>How can I use POST but pass the parameters delimited by slashes as it's expected? What am I doing wrong?</p>