Utils¶
Twitter API. |
|
HEPData user queries. |
hepdata.utils.file_extractor¶
hepdata.utils.miscellaneous¶
- hepdata.utils.miscellaneous.splitter(data, predicate)[source]¶
Split a list according to a given predicate (lambda).
- hepdata.utils.miscellaneous.sanitize_html(value, tags=None, attributes=None, strip=False)[source]¶
Sanitize HTML.
- Parameters
tags – Allowed HTML
tags
. Configuration set by Invenio-Config.attributes – Allowed HTML
attributes
. Configuration set by Invenio-Config.strip – Whether to strip tags that are not allowed. Defaults to False (escapes rather than strips disallowed tags).
Use this function when you need to include unescaped HTML that contains user provided data.
hepdata.utils.session¶
hepdata.utils.twitter¶
Twitter API.
- hepdata.utils.twitter.tweet(title, collaborations, url, version=1)[source]¶
Announce addition or revision of a HEPData record on Twitter.
- Parameters
title –
collaborations –
url –
version –
- Returns
hepdata.utils.url¶
- hepdata.utils.url.modify_query(path, **new_values)[source]¶
Fetch the query arguments, update them and generate a new URL.
- Parameters
path – [string] endpoint function name. Should contain the blueprint name or just a dot at the beginning for the same blueprint
**new_values – [string] dictionary containing parameters to update. When a parameter value is None, it is removed from the URL.
- Returns
[string] generated URL
hepdata.utils.users¶
HEPData user queries.
- hepdata.utils.users.get_user_from_id(user_id)[source]¶
Returns a user object from their id.
- Parameters
user_id – <int>
- Returns
User object if found, else None