The Pyisocapi library provides convenient access to the Isocapi API from apps written in Python. It includes client with multiple convenient methods to obtain data you need - both synchronously and asynchronously.
See our page: Isocapi
pip install --upgrade pyisocapi
- Python 3.10+
synchronous
from pyisocapi import IsocapiClient
api_key = "YOUR_API_KEY"
url = "OLX_URL"
client = IsocapiClient(api_key)
response = client.get_olx_by_url(url)
print(response)
>> IsocapiAPIResponse(data={'id': 1234, ...}]}, error='', message='Successfully retrieved data', success=True)
print(response.success)
>> True
asynchronous
import asyncio
from pyisocapi import IsocapiClient
async def main():
api_key = "YOUR_API_KEY"
url = "OLX_URL"
client = IsocapiClient(api_key)
response = await client.get_olx_by_url_async(url)
print(response)
asyncio.run(main())
>> IsocapiAPIResponse(data={'id': 1234, ...}]}, error='', message='Successfully retrieved data', success=True)
print(response.success)
>> True
Some of the methods (e.g. get_otodom_by_keyword) require more complex payloads that are wrapped in convenient types which can be imported from pyisocapi.payloads
Unsuccessful requests raise exceptions. The class of the exception will reflect the sort of error that occurred. To handle them yourself import them from pyisocapi.exceptions
If you have encountered a bug or have any ideas how to improve this library - don't be afraid to open an issue with an explanation.