Question about pv1: Handle APIVersions requests again

if api_version>4:
error_code=35
response_body=correlation_id.to_bytes(4,‘big’) + error_code.to_bytes(2,‘big’)
else:
error_code=0
response_body=b’’
response_body+=correlation_id.to_bytes(4,‘big’)
response_body+=error_code.to_bytes(2,‘big’)

    response_body+=(1).to_bytes(4,'big') #number of api keys
    response_body+=(18).to_bytes(2,'big') #fix for api versions
    response_body+=(0).to_bytes(2,'big') #min version
    response_body+=(4).to_bytes(2,'big') #max version
    response_body+=(0).to_bytes(4,'big') # throttle_time_ms 
    response_body += (0).to_bytes(1, 'big')



response_length=len(response_body).to_bytes(4,'big')
response=response_length + response_body

conn.sendall(response)

so basically this is my condition statement to send code i am always getting error for unexpected end for the data what could be the solution i wrote the format in correct way

Hey @faith-in-het, looks like you’ve got past this stage. Do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

1 Like

I dont really know the exact issue but when i hardcoded the length and just send response but just adding them all it worked
ex.
a=4+12+3
responce.sendall(int(a).to_bytes(4,‘big’
+corrID
+errcde
+..
+..
+…

)

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.