Last active
July 20, 2018 06:47
-
-
Save zema1/f050784ebbc90231c60e6b9ece9eb9cd to your computer and use it in GitHub Desktop.
Revisions
-
zema1 renamed this gist
Jul 20, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
zema1 created this gist
Jul 20, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ ``` def base64_url_encode(text): return base64.b64encode(text).replace('+', '-').replace('/', '_').replace('=', '') def base64_url_decode(text): text = text.replace('-', '+').replace('_', '/') while True: try: result = base64.b64decode(text) except TypeError: text += '=' else: break return result ```