def buildRequestFrames(headers, data, frameFactory=None, streamID=1):
 if (frameFactory is None):
  frameFactory = FrameFactory()
 frames = []
 frames.append(frameFactory.buildHeadersFrame(headers=headers, streamID=streamID))
 frames.extend((frameFactory.buildDataFrame(chunk, streamID=streamID) for chunk in data))
 frames[(-1)].flags.add('END_STREAM')
 return frames

def buildRequestFrames ( headers , data , frameFactory = None , streamID = 1 ) : if ( frameFactory is None ) : frameFactory = FrameFactory ( ) frames = [ ] frames . append ( frameFactory . buildHeadersFrame ( headers = headers , streamID = streamID ) ) frames . extend ( ( frameFactory . buildDataFrame ( chunk , streamID = streamID ) for chunk in data ) ) frames [ ( - 1 ) ] . flags . add ( 'END_STREAM' ) return frames
provides a sequence of http/2 frames that encode a single http request .