#NEWLINE# @ staticmethod #NEWLINE# def _construct_url( collection , entity , child , limit ) : #NEWLINE# #INDENT# 'Construct URL' #NEWLINE# url = [ collection ] #NEWLINE# if ( entity is not None ) : #NEWLINE# #INDENT# url . append ( str ( entity ) ) #NEWLINE# #UNINDENT# child_id = None #NEWLINE# if ( child is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# child_path = CHILD_PATHS [ child . lower ( ) ] #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ClientError ( '`child` must be a string of the entity to retrieve' ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise ClientError ( '`child` must correspond to an entity in T1' ) #NEWLINE# #UNINDENT# if child_path [ 1 ] : #NEWLINE# #INDENT# child_id = child_path [ 1 ] #NEWLINE# url . append ( child_path [ 0 ] ) #NEWLINE# url . append ( str ( child_path [ 1 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url . append ( child_path [ 0 ] ) #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( limit , dict ) : #NEWLINE# #INDENT# if ( len ( limit ) != 1 ) : #NEWLINE# #INDENT# raise ClientError ( 'Limit must consist of one parent collection (or chained parent collection) and a single value for it (e.g. {"advertiser": 1}, or {"advertiser.agency": 2)' ) #NEWLINE# #UNINDENT# url . extend ( [ 'limit' , '{0!s}={1:d}' . format ( * next ( six . iteritems ( limit ) ) ) ] ) #NEWLINE# #UNINDENT# return ( '/' . join ( limit ) , child_id )