API Reference¶
This is a WORK IN PROGRESS. We need to update all the docstrings to provide decent documentation here.
-
class
chinup.
Chinup
(queue, method, path, data, **kwargs)¶ A single FB request/response. This shouldn’t be instantiated directly, rather the caller should use a ChinupBar:
chinup = ChinupBar(token=’XYZ’).get(‘me’)This returns a chinup which is a lazy request. It’s on the queue and will be processed when convenient. The chinup can be access as follows:
chinup.response = raw response from FB chinup.data = dict or list from FB, depending on endpoint chinup[key] = shortcut for chinup.data[key] key in chinup = shortcut for key in chinup.dataThe preferred method for accessing a list response is to iterate or listify the chinup directly. This will automatically advance through paged data, whereas accessing chinup.data will not.
- list(chinup)
- OR
- for d in chinup:
- do something clever with d
-
completed
¶ Returns False if this chinup remains to be synced, otherwise returns a truthy tuple of (response, exception).
-
fetch_next_page
()¶ Prepare to load the next page by putting a chinup on the queue. This doesn’t actually do anything, of course, until .data or similar is accessed.
-
make_request_dict
()¶ Returns a dict suitable for a single request in a batch.
-
next_page
()¶ Returns the chinup corresponding to the next page, or None if il n’y en a pas.
-
classmethod
prepare_batch
(chinups)¶ Returns a tuple of (chinups, requests) where requests is a list of dicts appropriate for a batch request.
-
sync
()¶ Forces a sync of this chinup, as accessing .data would do. This is especially for chinups with a callback, where the caller wants to sync for the sake of triggering the callback.