Call

class TheNounProjectAPI.call.Call

Bases: object

Call is a class containing methods used as decorators, each helping with making the actual requests to the TheNounProject API.

static dispatch(f)

This method allows the use of singledispatch on methods, a feature that will be implemented in functools in Python 3.8.x+ in the future.

Parameters

f (Callable) – The decorated method.

Returns

Decorator method which takes the type of the second parameter instead of the first, as the first is self in a method, and passes this type on to the dispatcher.

Return type

Callable

static _get_endpoint(model_class, method)

Returns wrapper which receives a requests.PreparedRequests, sends this request, checks for exceptions, and returns the json parsed through the correct model.

Parameters
  • model_class (Union[Type[Model], Type[ModelList]]) – The class of the model to use for the output data.

  • method (str) – String form of which method to use. Either “GET” or “POST”.

Returns

Decorator function.

Return type

Callable

collection(method='GET', model_class=<class 'TheNounProjectAPI.models.CollectionModel'>)
collections(method='GET', model_class=<class 'TheNounProjectAPI.models.CollectionsModel'>)
icon(method='GET', model_class=<class 'TheNounProjectAPI.models.IconModel'>)
icons(method='GET', model_class=<class 'TheNounProjectAPI.models.IconsModel'>)
usage(method='GET', model_class=<class 'TheNounProjectAPI.models.UsageModel'>)
enterprise(method='POST', model_class=<class 'TheNounProjectAPI.models.EnterpriseModel'>)