OLX API Wrapper
A Python client for the OLX Developer API, enabling seamless integration with OLX services.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
About The Project
OLX API Wrapper is a Python library designed to simplify integration with the OLX Developer API. It allows developers to:
- Fetch user data
- Manage adverts with CRUD operations
- Access OLX API resources effortlessly
This library is ideal for developers looking to streamline their interaction with OLX services.
Built With
Getting Started
To use the OLX API Wrapper, you need to sign in to the OLX Developer Portal and create an app. For more details, visit Getting Access to the API.
Prerequisites
- [Not required for public API] Obtain your Client ID and Client Secret from the OLX Developer Portal.
- Store them securely (e.g., as environment variables). Avoid hardcoding them in your code.
Supported countries:
- OLX PL
- OLX BG
- OLX RO
- OLX PT
- OLX UA
- OLX KZ
By default, requests are sent to OLX PL. To change the country, pass the country_code argument to the relevant class:
from olx.partner import Auth, Adverts
auth = Auth(country_code="bg")
adverts = Adverts(country_code="ro")
Installation
-
Install the package:
pip install olx-api-wrapper
-
Authenticate using the authorization code:
from olx.partner import Auth auth = Auth(client_id="your_client_id", client_secret="your_client_secret") auth.authenticate(code="authorization_code") access_token = auth.access_token
-
Use the
AuthResponseobject to retrieve additional information:auth_response = auth.authenticate(code="authorization_code") print(auth_response.refresh_token) # Retrieve the refresh token
-
Refresh an expired access token:
auth.refresh(refresh_token=auth_response.refresh_token)
Usage
Below are examples of how to use the olx-api-wrapper in your project. Ensure you have an access token before proceeding.
Example 1: Fetch Authenticated User Info
from olx.partner import Users
users = Users(access_token="your_access_token")
user_info = users.get_authenticated_user()
print(user_info.email) # Output: john@mail.com
Example 2: Get Category Suggestions
from olx.partner import CategoriesAttributes
categories = CategoriesAttributes(access_token="your_access_token")
suggestions = categories.get_category_suggestions(ad_title="Honda Hornet")
print(suggestions)
Public API Methods
The olx.public module provides methods to interact with OLX's public API. Below are the available methods and their usage examples:
Example 1: Fetch Offers
from olx.public import OlxPublic
olx_public = OlxPublic()
offers = olx_public.get_offers(category_id=123, offset=0, limit=10)
print(offers)
Example 2: Get Offer Details
from olx.public import OlxPublic
olx_public = OlxPublic()
offer = olx_public.get_offer(offer_id=456)
print(offer)
Example 3: Get Suggested Offers
from olx.public import OlxPublic
olx_public = OlxPublic()
suggested_offers = olx_public.get_suggested_offers(offer_id=456)
print(suggested_offers)
Example 4: Get Offer Filters
from olx.public import OlxPublic
olx_public = OlxPublic()
filters = olx_public.get_offer_filters()
print(filters)
Example 5: Get Breadcrumbs
from olx.public import OlxPublic
olx_public = OlxPublic()
breadcrumbs = olx_public.get_breadcrumbs(category_id=123)
print(breadcrumbs)
Example 6: SEO Popular Searches
from olx.public import OlxPublic
olx_public = OlxPublic()
popular_searches = olx_public.seo.popular_searches(category_id=123, count=5)
print(popular_searches)
Example 7: SEO Offer Details
from olx.public import OlxPublic
olx_public = OlxPublic()
offer_seo = olx_public.seo.offer_seo(offer_id=456)
print(offer_seo)
Contributing
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a pull request.
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Paweł Stawikowski - pawikoski@gmail.com
Project Link: https://github.com/Pawikoski/olx-api-wrapper
Metadata
Release files for olx-api-wrapper 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| olx-api-wrapper-1.3.3.tar.gz | 22.7 kB | Without provenance | Details |
Release files / olx-api-wrapper-1.3.3.tar.gz
| Download URL | olx-api-wrapper-1.3.3.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
730d7c80467eeba60cd115755eeb24da32e2b5de71b5e95fb8d5966d1687b7e8
|
|
BLAKE2b-256 checksum How to use checksums |
168e367ac9c9d44d339bbcbf0e1369aa7b55c2d135ebdc11e923edcb6ae82b59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Security for olx-api-wrapper 1.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.