jwt: 'module' object has no attribute 'encode' <p>I am getting Module not found error when using jwt. Here is how I declared it:</p> <pre><code>def create_jwt_token(): payload = { "iat": int(time.time()) } shared_key = REST_API_TOKEN payload['email'] = EMAIL payload['password'] = PASSWORD jwt_string = jwt.encode(payload, shared_key) encoded_jwt = urllib.quote_plus(jwt_string) # url-encode the jwt string return encoded_jwt </code></pre> <p>The error message says encode is not found in jwt. I did a tab on jwt and found that the encode is a method inside jwt.JWT. I tried changing it to </p> <pre><code>jwt_string = jwt.JWT.encode(payload, shared_key) </code></pre> <p>and it gives an error "unbound method encode() must be called with JWT instance as first argument (got dict instance instead)"</p> <p>What am I doing it wrong? Here is the version info of my python environment:</p> <p>2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)]</p>