Utils methods

trojmiastopl.utils.decode_category_name(category)[source]

Decodes category name to it’s value

Parameters:category (str) – Category name
Returns:Category number
Return type:int
trojmiastopl.utils.decode_type(filter_value)[source]

Decodes offer type name to it’s value

List of available options and it’s translation can be found bellow.

Parameters:filter_value (str) – One of available type names
Returns:Int value for POST variable
Return type:int
trojmiastopl.utils.get_content_for_url(url)[source]

Connects with given url

If environmental variable DEBUG is True it will cache response for url in /var/temp directory

Parameters:url (str) – Website url
Returns:Response for requested url
trojmiastopl.utils.get_url(category, region=None, **filters)[source]

Creates url for given parameters

Parameters:
  • category (str) – Search category
  • region (str) – Search region
  • filters (dict) – Dictionary with additional filters. See :meth:’trojmiastopl.get_category’ for reference
Returns:

Url for given parameters

Return type:

str

trojmiastopl.utils.get_url_for_filters(payload)[source]

Parses url from trojmiasto.pl search engine using POST method for given payload of data

Parameters:payload (tuple) – Tuple of tuples containing POST key and argument
Returns:Url generated by trojmiasto.pl search engine
Return type:str