this has been very hard step for me learning how to do low level socket communication but I really want to learn this, I've come to a wall and I don't seem to be able to find the proper WAY.
How am I able to get all the data ? I've tried multiple things I'm just able to get partial of the response.
the URL I'm trying right now is:
http://steamcommunity.com/market/search/render/?query=&start=0&count=100&search_descriptions=0&sort_column=price&sort_dir=asc&appid=730&category_730_ItemSet%5B%5D=any&category_730_ProPlayer%5B%5D=any&category_730_TournamentTeam%5B%5D=any&category_730_Weapon%5B%5D=any&category_730_Rarity%5B%5D=tag_Rarity_Ancient_Weapon
After research I tried this way but still wasn't able to print the full JSON page above, anything I'm doing wrong ?
sock.send(request)
response = ""
first = True
length = 0
while True:
partialResponse = sock.recv(65536)
if len(partialResponse) != 0:
#print("all %s" % partialResponse)
# Extract content length from the first chunk
if first:
startPosition = partialResponse.find("Content-Length")
if startPosition != -1:
endPosition = partialResponse.find("\r\n", startPosition+1)
length = int(partialResponse[startPosition:endPosition].split(" ")[1])
first = False
# add current chunk to entire content
response += partialResponse
# remove chunksize from chunck
startPosition = response.find("\n0000")
if startPosition != -1:
endPosition = response.find("\n", startPosition+1)
response = response[0:startPosition-1] + response[endPosition+1:]
if len(response[response.find("\r\n\r\n")+2:]) > length:
break
else:
break
print response