title: How to make a Curl equivalent call using Python urllib
body: <p>My working cUrl is as follows:</p>
  
  <pre><code>curl https://mixpanel.com/api/2.0/jql \
      -u YOUR_API_SECRET: \
      --data-urlencode script@my_query.js
  </code></pre>
  
  <p>Now I am not able to make it work using <code>urllib2</code>, I have tried but getting <strong>(401) error</strong></p>
  
  <pre><code>        url = "https://mixpanel.com/api/2.0/jql"
          token = "MY_TOKEN:"
  
          request = Request(url)
          request.add_header('-u',  token)
          response = urlopen(request)
  </code></pre>
  
  <p>Any help</p>