Introduction

pytrojmiastopl supplies two methods to scrape data from www.ogloszenia.trojmiasto.pl website

Scraping category data

This method scrapes available offer urls from trojmiasto.pl search results with parameters

trojmiastopl.category.get_category(category, region=None, **filters)[source]

Parses available offer urls from given category from every page

Parameters:
  • category – Search category
  • region – Search region
  • filters – Dictionary with additional filters. Following example dictionary contains every possible filter

with examples of it’s values.

Example:
input_dict = {

“offer_type”: “Mieszkanie”, # offer type. See :meth:`utils.decode_type’ for reference “cena[]”: (300, None), # price (from, to). None if you don’t want to pass one of arguments “kaucja[]: (100,1000), # deposit “cena_za_m2[]”: (5, 100), # price/surface “powierzchnia[]”: (23, 300), # surface “l_pokoi[]”: (2, 5), # desired number of rooms “pietro[]”: (-1, 6), # desired floor, enum: from 1 to 49 and -1 (ground floor) “l_pieter[]”: (1, 10), # desired total number of floors in building “rok_budowy[]”: (2003, 2017), # date of built “data_wprow”: “1d” # date of adding offer. Available: 1d - today, 3d - 3 days ago, 1w - one week ago,

# 3w - 3 weeks ago

}

Returns:List of all offers for given parameters
Return type:list

It can be used like this:

input_dict = {"cena[]": (300, None)}
parsed_urls = trojmiastopl.category.get_category("nieruchomosci-mam-do-wynajecia", "Gdańsk", **input_dict)

The above code will put a list of urls containing all the apartments found in the given category into the parsed_url variable

Scraping offer data

This method scrapes all offer details from

It can be used like this:

descriptions = trojmiastopl.offer.get_descriptions(parsed_urls)

The above code will put a list of offer details for each offer url provided in parsed_urls into the descriptions variable