def fetch_token_header_payload(token):
 token = token.encode(u'utf-8')
 try:
  (signing_input, crypto_segment) = token.rsplit('.', 1)
  (header_segment, payload_segment) = signing_input.split('.', 1)
 except ValueError:
  raise jwt.DecodeError(u'Not enough segments')
 try:
  header = json.loads(jwt.utils.base64url_decode(header_segment).decode(u'utf-8'))
 except TypeError as e:
  current_app.logger.exception(e)
  raise jwt.DecodeError(u'Invalid header padding')
 try:
  payload = json.loads(jwt.utils.base64url_decode(payload_segment).decode(u'utf-8'))
 except TypeError as e:
  current_app.logger.exception(e)
  raise jwt.DecodeError(u'Invalid payload padding')
 return (header, payload)

def fetch_token_header_payload ( token ) : token = token . encode ( u'utf-8' ) try : ( signing_input , crypto_segment ) = token . rsplit ( '.' , 1 ) ( header_segment , payload_segment ) = signing_input . split ( '.' , 1 ) except ValueError : raise jwt . DecodeError ( u'Not enough segments' ) try : header = json . loads ( jwt . utils . base64url_decode ( header_segment ) . decode ( u'utf-8' ) ) except TypeError as e : current_app . logger . exception ( e ) raise jwt . DecodeError ( u'Invalid header padding' ) try : payload = json . loads ( jwt . utils . base64url_decode ( payload_segment ) . decode ( u'utf-8' ) ) except TypeError as e : current_app . logger . exception ( e ) raise jwt . DecodeError ( u'Invalid payload padding' ) return ( header , payload )
fetch the header and payload out of the jwt token .