Skip to main content

PyPI PyPI

OLX Python Client (py-olx-client)

py-olx-client is a Python client library for interacting with the OLX API. It provides an easy way to interact with the OLX platform, allowing you to manage users, ads, and more.

Features

  • Retrieve user information
  • Get ad details
  • Get contact numbers for ads
  • Token management (refresh)

Installation

You can install the library via pip:

pip install py-olx-client

1. Initialize the OLX Client

You need an OLX API access token to authenticate. Once you have the token, initialize the OLX class.

from py_olx import OLX

# Replace with your actual access token
access_token = "your_access_token"
olx = OLX(access_token)

2.Retrieve Authenticated User

You can retrieve the details of the currently authenticated user.

# Fetch authenticated user details
user_details = olx.user.get_authenticated_user()
print(user_details)

3. Retrieve User by ID

To retrieve information about a user by their user ID:

user_id = 12345  # Replace with the user ID
user_info = olx.user.get_user(user_id)
print(user_info)

4.Working with Ads

Get Advertisement by ID To retrieve details about a specific ad by its ID:

ad_id = 123456  # Replace with the ad ID
ad_details = olx.ads.get_ad(ad_id)
print(ad_details)

5.Get Contact Number for an Advertisement

To retrieve the contact number for a specific advertisement:

contact_number = olx.ads.get_contact_number(ad_id)
print(contact_number)

6.Refreshing Token

You can refresh the token using the OLXAuth class. Here is an example of refreshing the token:

from py_olx import OLXAuth

# Replace with the client ID, client secret, and the refresh token you got during initial auth
client_id = "your_client_id"
client_secret = "your_client_secret"
refresh_token = "your_refresh_token"

auth = OLXAuth(client_id, client_secret,refresh_token)
new_access_token = auth.refresh_token()
print(f"New Access Token: {new_access_token}")

Future Features

  • Posting, Editing, and Deleting Ads: Implement functionality to post, edit, and delete ads.
  • Search Ads by Category: Add search functionality based on categories and filters.
  • Retrieve and Clear Statistics: Fetch and reset ad statistics.
  • Respond to Messages: Add support for responding to messages related to ads.

Metadata

Release files for py-olx-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-olx-client 0.1.1
File Size Uploaded Provenance Actions
py_olx_client-0.1.1.tar.gz 18.0 kB Without provenance Details for py_olx_client-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-olx-client 0.1.1
File Interpreter ABI Platform Actions
py_olx_client-0.1.1-py3-none-any.whl Python 3 none any Details for py_olx_client-0.1.1-py3-none-any.whl

Total release size: 37.2 kB

Release files / py_olx_client-0.1.1.tar.gz

Download URL py_olx_client-0.1.1.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4f90a4b89beae3c70161cad470cbdac8e08eedb3c44a09aa2363d3595327473f
BLAKE2b-256 checksum
How to use checksums
134a176c34cec48b52bad2a302f6aefa936282543f15a3c4d71dbb4559838cff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

Release files / py_olx_client-0.1.1-py3-none-any.whl

Download URL py_olx_client-0.1.1-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c53397d830264dbfb6266b467518d2db88ab99a1cf241b76e8004abe372c640a
BLAKE2b-256 checksum
How to use checksums
069f8a30f069c9de5584d47a6e08febd43e08a49afa61bd65ad16dd0147da1c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

Security for py-olx-client 0.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page