Catalog PyPI
PACKAGE EXPLORERView in registry

AdvertsAPI

PyPI

An unofficial API for the community based Irish marketplace, adverts.ie

Versions collected1
Direct dependencies0From release 1.0.1
Last observed20 Oct, 20:03 UTC

README

Version 1.0.1 documentation

AdvertsAPI

An unofficial API for the community based Irish marketplace, adverts.ie.

Getting Started

Prerequisites

  • Python 3.6 >=

Installing

pip install AdvertsAPI

Dependecies

pip install requests
pip install beautifulsoup4 
pip install mechanize

Imports

import AdvertsAPI
from AdvertsAPI.category import Category
from AdvertsAPI.utils import pretty_json

Available Methods

  • Constructor
  • login
  • get_ad_panel
  • place_offer
  • withdraw_offer
  • full_ad_info
  • search_query
  • logout

Constructor

Default: category=None, county=None, min_price=0, max_price=0, view='grid_view', search=None

advert = AdvertsAPI.AdvertsAPI()

Bike in Dublin: category=Category.SPORTS_FITNESS__BIKES, county='Dublin', min_price=0, max_price=0, view='grid_view', search=None

advert = AdvertsAPI.AdvertsAPI(category=Category.SPORTS_FITNESS__BIKES, county='Dublin')

Mountain bike in Dublin: category=Category.SPORTS_FITNESS__BIKES, county='Dublin', min_price=0, max_price=0, view='grid_view', search='mountain'

advert = AdvertsAPI.AdvertsAPI(category=Category.SPORTS_FITNESS__BIKES, county='Dublin', search='mountain')

ps4 between 100-300 euro: category=Category.CONSOLES_GAMES, county=None, min_price=100, max_price=300, view='grid_view', search='ps4'

advert = AdvertsAPI.AdvertsAPI(category=Category.CONSOLES_GAMES, min_price=100, max_price=300, search='ps4')

free items in Dublin: category=None, county='Dublin', min_price=0, max_price=0, view='grid_view', search=None

advert = AdvertsAPI.AdvertsAPI(county='Dublin')

login

adverts = AdvertsAPI.AdvertsAPI()
adverts.login('username', 'password')

get_ad_panel

NOTE: given the contructor details, it will produce the url for the search.

ads = advert.get_ad_panel()

However you could also pass in the url of the search and it will compute for you.

ads = advert.get_ad_panel('https://www.adverts.ie/for-sale/price_0-0/')

It will return a list of the top 30 ads for that search. The attributes that can be retreived are: price, title, area, county, category and url

for ad in ads:
    print(ad.price)
    print(ad.title)
    print(ad.area)
    print(ad.county)
    print(ad.category)
    print(ad.url)

place_offer

This will place an offer given the url of the ad directly.

Below is an example given a url that is static.

advert.place_offer('ad_url', 100)   

Below will place an offer on the first ad of the ads retreieved above.

advert.place_offer(ads[0].url, 0)

withdraw_offer

Withdraws an offer to a particular ad, given the url. You must have an active offer to withdraw the ad.

advert.withdraw_offer('ad_url')    

full_ad_info

This will return all the information of the ad given the url. The attributes that can be retreived are: title, price, seller, positive, negative, location date_entered, ad_views and description.

advert.full_ad_info('ad_url')
ads = advert.full_ad_info(ads[0].url)

You can retreive the data as follows:

for ad in ads:
    print(ad.title)
    print(ad.price)
    print(ad.seller)
    print(ad.positive)
    print(ad.negative)
    print(ad.location)
    print(ad.date_entered)
    print(ad.ad_views)
    print(ad.description)

search_query

Search query will use the constructor generated url to search for ads.

advert.search_query()

However you can pass a search query to the method and it will return the search results of the query.

# search_query (given query)
ads = advert.search_query('mountain bikes')

Similar to the get_ad_panel method, you can retreive the data as below:

for ad in ads:
    print(ad.title)
    # ...
    print(ad.url)

logout

Not very necessary as it will discard the cookies as the program stops.

adverts.logout()

Usage

For documented examples see examples.py

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.126 Dec 20200

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
ahmedhamedaly/adverts-api

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:03 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:6beebcbb14230b2385f8f4950ff5815e1ac621d9078010fddd4a680e7467bb07