Python API for retrieving information from olx.ba
- Install by simply running:
pip install git+https://github.com/ishakd00/olxba-py.git
An olx.ba account is needed for this API to work. Authenticate by passing your login info to the OlxAPI constructor like so:
from olxba import OlxAPI
parser = OlxAPI ('username', 'password')
search(searchText, sortOrder, sortBy, category, id, condition, page)
Provides limited search functonality.
searchText
- text you would enter into the search bar - stringsortOrder
- Sort ascending or descending - string 'asc' or 'desc' (default: 'desc')sortBy
- By what property to sort - string 'price', 'date' or 'relevance'category
- Olx lowest subcategory id, I plan to make a table for this but for now you're on your own exploring on olx.ba - integerid
- Olx (?parent?) category id, still don't understand exactly how this works but it's similar tocategory
and you can just leave it unset if you setcategory
- integerpage
- Search page number - integer
List of listings.
getListingById(listingId) Returns instance of OlxListing for listing with listingId.
listingId
- olx.ba listing id - integer
Instance of OlxListing
class OlxListing
- listingId - integer
- title - string
- dateUpdated - datetime object
- dateUploaded - datetime object
- condition - string - 'new' or 'used'
- hasShipping - boolean
- freeShupping - boolean
- otherProperties - dictionary containing all listing details