Skip to content

Commit

Permalink
feat: Update Python script to Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiehl committed Jan 22, 2024
1 parent d25b3e1 commit 4268760
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions secure_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import base64
import hashlib
Expand All @@ -8,7 +8,8 @@
expire = '1470055000'

md5 = hashlib.md5()
md5.update(secret + uri + expire)
token = base64.b64encode(md5.digest()).replace('=','').replace('+','-').replace('/','_')
md5.update((secret + uri + expire).encode('utf-8'))
token = base64.b64encode(md5.digest()).decode('utf-8').replace('=','').replace('+','-').replace('/','_')

print('http://www.example.org%s?st=%s&e=%s' % (uri, token, expire))

print 'http://www.example.org%s?st=%s&e=%s' % (uri, token, expire)

0 comments on commit 4268760

Please sign in to comment.