shared submodule

Functions, objects and properties shared across many classes in this project.

abclinuxuapi.shared.ABCLINUXU_URL = ''

Base URL of the abclinuxu.

abclinuxuapi.shared.SESSION = <requests.sessions.Session object>

Session which is used in non-private requests., params=None, method='GET', session=None, as_text=True, data=None)

Download data from url using method. Send params if defined.

  • url (str) – Absolute URL from which the data will be downloaded.
  • params (dict, default None) – Send parameters (GET/POST).
  • data (dict, default None) – Data which will be sent as body of the request.
  • method (str, default "GET") – Use this method to send the request.
  • session (obj, default None) – If None, shared SESSION object is used.
  • as_text (bool, default True) – Return content as UTF-8 encoded string. If false bytes are returned.

Content depending on the as_text attribute.

Return type:



Return first element from inp_data, or raise StopIteration.


This function was created because it works for generators, lists, iterators, tuples and so on same way, which indexing doesn’t.

Also it have smaller cost than list(generator)[0], because it doesn’t convert whole inp_data to list.

Parameters:inp_data (iterable) – Any iterable object.
Raises:StopIteration – When the inp_data is blank.

Convert abclinuxu relative or absolute date string in czech words to timestamp.

Parameters:date (str) – One of many abclinuxu representations of date string.
Return type:int

Return all lines, that looks like it may be date in one of three abclinuxu formats.

Parameters:lines (list) – List of strings with lines which ma by dates.
Returns:List of lines, which looks like they may contain dates.
Return type:list

Parse numeric timestamp from the date representation.

Parameters:meta (str) – Meta html from the blogpost body.
Return type:int

Convert numeric timestamp into format used by abclinuxu for concepts.

Parameters:timestamp (int) – Timestamp as float/int.
Returns:Converted timestamp.
Return type:str

Add rel_url to the absolute context with ABCLINUXU_URL.

Parameters:rel_url (str) – Relative URL.
Returns:Absolute URL.
Return type:str

Look for error divs in given dom tree.

Parameters:dom (obj) – dhtmlparser.HTMLElement instance.
Raises:UserWarning – With content of the error div if the div was found.
abclinuxuapi.shared.check_error_div(data, error_div)

Dunno about this, it was created long time ago and I have no idea.


Handle other, special kind of errors.