Queried WebClient

Letting the client do the work.

This component makes working with requests a little easier in introducing a somewhat async workflow by taking a request on  one after another with an extensive API. 
It makes life a little easier by autoparsing requests and responses to JSON.

  • Server : The base domain all requests will be appended to.

  • QueryRequest(request_dict : Dictionary): Takes a dictionary and appends it to the queue and fires it off if nothing is requesting at the moment. The Dict needs to be formatted the following way:
    method: HTTP Request method as a string. ("GET", "POST", ...)
    url: The target  URL including query-params.
    header: The header as a Dictionary.
    body: The data you want to send in the requestbody.
    callback: A method taking one argument that gets called when the request returns a success.
  • MultipartFormData( dictionary ): Returns the dictionary as multipart-formdata in bytes. Header needs to be set manually.
  • Get( endpoint: string, params: Dict, header: Dict, callback: function) : Query a get request. Except endpoint everything else is optional.
  • Post,Put,Delete(  endpoint: string, params: Dict, header: Dict, callback: function, data ): Creates a Post/Put/Delete request.
    If the data is delivered as a dictionary, it will be converted to JSON and the apllicationtype Json will be applied to the header.

For get one page of catbreeds from catfact.ninja and print it out call:

params = {"limit" : 1},
callback = lambda response: debug(response))

Downloads: 50

Created at: 6.8.2021

Uploaded: 3.11.2021
Added the params-member to the request_dict which will be returned in the callback.