initial docs, still incomplete but is a lot

pull/39/head
Ciro 2022-11-17 18:36:01 -03:00
rodzic 9c8ecc60ee
commit 578a964890
3 zmienionych plików z 10 dodań i 16 usunięć

Wyświetl plik

@ -143,6 +143,7 @@ function format_message(message, user){
message.name = 'You';
message_element.classList.add('chat-message-right');
}else{
message.name = message.name || message.login;
message_element.classList.add('chat-message-left');
}

Wyświetl plik

@ -10,11 +10,7 @@ def graphiql_from(Query, Mutation=None):
async def post(res, req):
# we can pass whatever we want to context, query, headers or params, cookies etc
context_value = {
"query": req.get_queries(),
"headers": req.get_headers(),
"params": req.get_parameters(),
}
context_value = req.preserve()
# get all incomming data and parses as json
body = await res.get_json()

Wyświetl plik

@ -21,10 +21,8 @@ async def upload_chunks(res, req):
# await all the data, returns received chunks if fail (most likely fail is aborted requests)
data = await res.get_data()
print(f"Got {len(data)} chunks of data!")
for chunk in data:
print(f"Got chunk of data with length {len(chunk)}")
print(f"Got chunks {len(data)} of data!")
# We respond when we are done
res.cork_end("Thanks for the data!")
@ -32,11 +30,10 @@ async def upload_chunks(res, req):
async def upload_json(res, req):
print(f"Posted to {req.get_url()}")
# await all the data and parses as json, returns None if fail
people = await res.get_json()
if isinstance(people, list) and isinstance(people[0], dict):
print(f"First person is named: {people[0]['name']}")
info = await res.get_json()
print(info)
# We respond when we are done
res.cork_end("Thanks for the data!")
@ -46,7 +43,7 @@ async def upload_text(res, req):
# await all the data and decode as text, returns None if fail
text = await res.get_text() # first parameter is the encoding (default utf-8)
print(f"Your text is ${text}")
print(f"Your text is {text}")
# We respond when we are done
res.cork_end("Thanks for the data!")
@ -59,7 +56,7 @@ async def upload_urlencoded(res, req):
await res.get_form_urlencoded()
) # first parameter is the encoding (default utf-8)
print(f"Your form is ${form}")
print(f"Your form is {form}")
# We respond when we are done
res.cork_end("Thanks for the data!")
@ -76,7 +73,7 @@ async def upload_multiple(res, req):
else:
data = await res.get_text()
print(f"Your data is ${data}")
print(f"Your data is {data}")
# We respond when we are done
res.cork_end("Thanks for the data!")