oxylabs

raw JSON →
3.0.0 verified Fri May 01 auth: no python

Official Python library for Oxylabs Scraper APIs (Web Scraper API, Real-Time Crawls, etc.). Current version 3.0.0, released Apr 2025. Active development with monthly releases.

pip install oxylabs
error ModuleNotFoundError: No module named 'oxylabs.webscraper'
cause Import path changed in v3; WebScraper now at top level.
fix
Use: from oxylabs import WebScraper
error AttributeError: module 'oxylabs' has no attribute 'RealTimeCrawl'
cause In v3, Renamed to RealTimeCrawlConnector or similar; check docs.
fix
Use: from oxylabs import RealTimeCrawlConnector
error ValueError: Invalid username or password
cause Empty or wrong credentials; ensure environment variables set.
fix
Set OXYLABS_USERNAME and OXYLABS_PASSWORD, or pass them to the constructor.
breaking v3.0.0 removed synchronous RealTimeCrawl methods; only async available.
fix Use async/await with RealTimeCrawl. For sync, stick to v2.x.
deprecated Direct credential strings in code are deprecated; use environment variables or config.
fix Set OXYLABS_USERNAME and OXYLABS_PASSWORD environment variables.
gotcha .get() on WebScraper raises OxylabsConnectionError on network failures; not caught by default.
fix Wrap in try/except: except oxylabs.exceptions.OxylabsConnectionError: ...

Instantiate WebScraper with credentials from environment variables, then call .get() on a URL.

from oxylabs import WebScraper

scraper = WebScraper(
    username=os.environ.get('OXYLABS_USERNAME', ''),
    password=os.environ.get('OXYLABS_PASSWORD', '')
)
response = scraper.get('https://example.com')
print(response.text)