Utilities#
Utility functions.
tweetkit.utils.copy#
Reimplements copy with json.
- tweetkit.utils.copy.deepcopy(data)#
Implements deep copy with json library.
- Parameters:
data (Any) – An object to geet the deep copy from.
- Returns:
copy – A deep copy of a provided object.
- Return type:
Any
tweetkit.utils.json#
Extended JSON functionality.
- tweetkit.utils.json.dump(obj, fp, *args, **kwargs)#
Save object to a file.
- Parameters:
obj (dict or object) – Object(s) to save.
fp (str, path object, file-like object, or None, default None) – Path or IO to save the object.
args (Any) – Other arguments to simplejson.dump.
kwargs (Any) – Other keyword arguments to simplejson.dump.
- Return type:
None
- tweetkit.utils.json.dumps(obj, *args, **kwargs)#
Get JSON string.
- Parameters:
obj (Mapping or Sequence or object) – Object(s) to save.
args (Any) – Other arguments to simplejson.dump.
kwargs (Any) – Other keyword arguments to simplejson.dump.
- Returns:
s – The string representation of the input string object.
- Return type:
str
- tweetkit.utils.json.loads(s)#
Load a JSON string to a dict.
- Parameters:
s (str or requests.Response) – A string input.
- Returns:
data – Loaded repr.
- Return type:
dict