Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

minor fixes

  • Loading branch information...
commit 44b964fbc97d21ab1b430080987ee4f2545f6e24 1 parent bdc87ec
Jeff Lindsay authored April 05, 2011

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  bin/jwt
10  bin/jwt
@@ -14,8 +14,6 @@ def fix_optionparser_whitespace(input):
14 14
     doublespace = '\033[8m.\033[0m' * 2
15 15
     return input.replace('  ', doublespace).replace('\n', newline)
16 16
 
17  
-
18  
-
19 17
 def main():
20 18
     """Encodes or decodes JSON Web Tokens based on input
21 19
   
@@ -24,7 +22,7 @@ Decoding examples:
24 22
   %prog --key=secret json.web.token
25 23
   %prog --no-verify json.web.token
26 24
   
27  
-Encoding requires the key argument and takes space separated key/value pairs 
  25
+Encoding requires the key option and takes space separated key/value pairs 
28 26
 separated by equals (=) as input. Examples:
29 27
   
30 28
   %prog --key=secret iss=me exp=1302049071
@@ -58,7 +56,7 @@ The exp key is special and can take an offset to current Unix time.
58 56
                     sys.exit(0)
59 57
                 except jwt.DecodeError, e:
60 58
                     print e
61  
-                    sys.exit(0)
  59
+                    sys.exit(1)
62 60
         except jwt.DecodeError:
63 61
             pass
64 62
         
@@ -72,7 +70,7 @@ The exp key is special and can take an offset to current Unix time.
72 70
         for arg in arguments:
73 71
             try:
74 72
                 k,v = arg.split('=', 1)
75  
-                # exp special case?
  73
+                # exp +offset special case?
76 74
                 if k == 'exp' and v[0] == '+' and len(v) > 1:
77 75
                     v = str(int(time.time()+int(v[1:])))
78 76
                 # Cast to integer?
@@ -95,8 +93,10 @@ The exp key is special and can take an offset to current Unix time.
95 93
         
96 94
         try:
97 95
             print jwt.encode(payload, key=options.key, algorithm=options.algorithm)
  96
+            sys.exit(0)
98 97
         except Exception, e:
99 98
             print e
  99
+            sys.exit(1)
100 100
     else:
101 101
         p.print_help()
102 102
 

0 notes on commit 44b964f

Please sign in to comment.
Something went wrong with that request. Please try again.