How to URL encode in Python 3? : <p>I have tried to follow <a href="https://docs.python.org/3.0/library/urllib.parse.html" rel="noreferrer">the documentation</a> but was not able to use <code>urlparse.parse.quote_plus()</code> in <code>Python 3</code>:</p>

<pre><code>from urllib.parse import urlparse

params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'})
</code></pre>

<p>I get</p>

<blockquote>
  <p>AttributeError: 'function' object has no attribute 'parse'</p>
</blockquote>
