Offer methods

olx.offer.get_additional_rent(offer_markup)[source]

Searches for additional rental costs

Parameters:offer_markup (str) –
Returns:Additional rent
Return type:int
olx.offer.get_date_added(offer_markup)[source]

Searches of date of adding offer

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Unix timestamp
Return type:int
olx.offer.get_gps(offer_markup)[source]

Searches for gps coordinates (latitude and longitude)

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Tuple of gps coordinates
Return type:tuple
olx.offer.get_gpt_script(offer_markup)[source]

Parses data from script of Google Tag Manager

Parameters:offer_markup (str) – Body from offer page markup
Returns:GPT dict data
Return type:dict
olx.offer.get_img_url(offer_markup)[source]

Searches for images in offer markup

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Images of offer in list
Return type:list
olx.offer.get_month_num_for_string(value)[source]

Map for polish month names

Parameters:value (str) – Month value
Returns:Month number
Return type:int
olx.offer.get_poster_name(offer_markup)[source]

Searches for poster name

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Poster name or None if poster name was not found (offer is outdated)
Return type:str, None
Except:Poster name not found
olx.offer.get_surface(offer_markup)[source]

Searches for surface in offer markup

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Surface or None if there is no surface
Return type:float, None
Except:When there is no offer surface it will return None
olx.offer.get_title(offer_markup)[source]

Searches for offer title on offer page

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Title of offer
Return type:str, None
olx.offer.parse_description(offer_markup)[source]

Searches for description if offer markup

Parameters:offer_markup (str) – Body from offer page markup
Returns:Description of offer
Return type:str
olx.offer.parse_flat_data(offer_markup, data_dict)[source]

Parses flat data

Data includes if offer private or business, number of floor, number of rooms, built type and furniture.

Parameters:
  • offer_markup (str) – Body from offer page markup
  • data_dict (dict) – Dict with GPT script data
Returns:

Dictionary of flat data

Return type:

dict

olx.offer.parse_offer(url)[source]

Parses data from offer page url

Parameters:
  • url (str) – Offer page markup
  • url – Url of current offer page
Returns:

Dictionary with all offer details or None if offer is not available anymore

Return type:

dict, None

olx.offer.parse_region(offer_markup)[source]

Parses region information

Parameters:offer_markup (str) – Class “offerbody” from offer page markup
Returns:Region of offer
Return type:list
olx.offer.parse_tracking_data(offer_markup)[source]

Parses price and add_id from OLX tracking data script

Parameters:offer_markup (str) – Head from offer page
Returns:Tuple of int price and it’s currency or None if this offer page got deleted
Return type:tuple, None
Except:This offer page got deleted and has no tracking script.