Skip to main content

chrono24

Project description

chrono24


Chrono24 API wrapper

pypiv Python 3.7+ continuous-integration Licence

Installation

pip install chrono24

Quick Start

Perform a standard search for Rolex DateJust watches:

import chrono24

for listing in chrono24.query("Rolex DateJust").search():
    print(listing)

Example output:

>>> {'id': '32322343',
    'url': 'https://chrono24.com/rolex/datejust-41mm-blue-diamond-dial-2022---126334--id32322343.htm',
    'manufacturer': 'Rolex',
    'certification_status': 'Basic',
    'title': 'Rolex Datejust 41',
    'description': '41mm Blue Diamond Dial 2022 - 126334',
    'price': '$16,553',
    'shipping_price': '$396',
    'location': 'Düsseldorf, Germany.',
    'merchant_name': 'Dealer',
    'badge': 'Professional',
    'image_urls': ['https://cdn2.chrono24.com/images/uhren/32322343-gp8hzm4ppkzsbhzc7s7bl2vh-ExtraLarge.jpg',
    'https://cdn2.chrono24.com/images/uhren/32322343-u7wq78hxqoalnfrlag1gkt8d-ExtraLarge.jpg',
    'https://cdn2.chrono24.com/images/uhren/32322343-93ykurb99s654x7aysnh8ljs-ExtraLarge.jpg',
    'https://cdn2.chrono24.com/images/uhren/32322343-gxd85po61ynmoictprm1gvfq-ExtraLarge.jpg',
    'https://cdn2.chrono24.com/images/uhren/32322343-den0sntpacmucq5zdktzul70-ExtraLarge.jpg']}
    # ...

Usage

Search for standard or detailed watch listings for any query, limiting results to, for example, 25 listings. All results will be retrieved if no limit is provided, and they'll be sorted by new listings first.

import chrono24

rolex_dj = chrono24.query("Rolex DateJust")

# Search for standard listings
for listing in rolex_dj.search(limit=25):
    print(listing)

# Search for detailed listings
for detailed_listing in rolex_dj.detailed_search(limit=25):
    print(detailed_listing)

Note: When using these functions, be cautious not to overwhelm Chrono24 with excessive requests. The standard_search method consumes 1 request per 120 posts retrieved, while detailed_search utilizes 1 request per individual post. Avoid flooding requests to maintain a balanced usage of the Chrono24 service and prevent any potential access limitations.

API Outputs

Example output from .search:

{
    'id': '32322343',
    'url': 'https://chrono24.com/rolex/datejust-41mm-blue-diamond-dial-2022---126334--id32322343.htm',
    'manufacturer': 'Rolex',
    'certification_status': 'Basic',
    'title': 'Rolex Datejust 41',
    'description': '41mm Blue Diamond Dial 2022 - 126334',
    'price': '$16,553',
    'shipping_price': '$396',
    'location': 'Düsseldorf, Germany.',
    'merchant_name': 'Dealer',
    'badge': 'Professional',
    'image_urls': [...],  # List of image URLs
}

Example output from .detailed_search, which extends results from .search:

{
    'id': '32322343',
    'url': 'https://chrono24.com/rolex/datejust-41mm-blue-diamond-dial-2022---126334--id32322343.htm',
    'manufacturer': 'Rolex',
    'certification_status': 'Basic',
    'title': 'Rolex Datejust 41',
    'description': '41mm Blue Diamond Dial 2022 - 126334',
    'price': '$16,553',
    'shipping_price': '$396',
    'location': 'Düsseldorf, Germany.',
    'merchant_name': 'Dealer',
    'badge': 'Professional',
    'image_urls': [...],  # List of image URLs
    'listing_code': 'J8S2V6',
    'brand': 'Rolex',
    'model': 'Datejust 41',
    'reference_number': '126334',
    'dealer_product_code': '8675310109006',
    'case_material': 'Steel',
    'bracelet_material': 'Steel',
    'year_of_production': '2022',
    'condition': 'Very good (Worn with little to no signs of wear)',
    'scope_of_delivery': 'Original box, original papers',
    'availability': 'Item needs to be procured',
    'case_diameter': '41 mm',
    'bracelet_color': 'Steel',
    'availabe_payments': [...],  # List of available payment methods
    'anticipated_delivery': 'Latest anticipated delivery on 1/22',
    'merchant_rating': '4.4',
    'merchant_reviews': '196',
    'merchant_badges': [...],  # List of merchant badges
}

Note: Output keys in .search will always be constant, but .detailed_search can vary based on information provided by the listing page, expanding on the details retrieved by .search.

Filters

You can refine your watch searches using various filter criteria, as well as define year ranges using min_year and max_year. Pre-defined filters include options such as case material, bracelet type, movement type, and more. These filters and year constraints can be applied when creating a query object.

How to Use Filters

To use filters, specify them when creating a query using the filters argument. You can pass a single string, a list/tuple of filter keys, or include year constraints using the min_year and max_year parameters:

import chrono24

# Initialize a query with a single filter
steel_rolex_dj = chrono24.query("Rolex DateJust", filters="steel")
# Initialize a query with multiple filters
steel_auto_rolex_dj = chrono24.query("Rolex DateJust", filters=["steel", "automatic"])
# Initialize a query with year constraints
new_rolex_dj = chrono24.query("Rolex DateJust", min_year=2010, max_year=2020)
# Combine filters and year constraints
new_steel_auto_rolex_dj = chrono24.query("Rolex DateJust", filters=["steel", "automatic"], min_year=2010, max_year=2020)

Available Filter Categories

The available filter categories are:

  • Case Filters: Material, diameter, and more.
  • Clasp Filters: Clasp type, material, etc.
  • Condition and Delivery Contents: Item condition, delivery options, included papers/box.
  • Dial Filters: Dial color, numerals, etc.
  • Location Filters: Country-specific filters.
  • Movement and Functions: Manual, automatic, complications.
  • Other Filters: Miscellaneous filters such as water resistance, glass type.
  • Seller and Listing Type: Dealer, private seller, new/used.
  • Sort By: Sorting options like 'Newest listings first', 'Price ascending', etc.
  • Strap and Bracelet: Bracelet material, color, strap type.
  • Watch Type: Sports, dress, luxury, and more.

Finding Filters

You can view all available filters using the chrono24.filters.show() method:

import chrono24

# Display all available filter categories and keys
chrono24.filters.show()

This will print a categorized list of all possible filters, helping you decide which ones to apply to your query. If you're not sure which filter to use, you can also search for filter keys using the chrono24.filters.search(query) method:

import chrono24

# Search for filters related to 'steel'
chrono24.filters.search("steel")

Example output:

Search results for query 'steel':

Direct matches:
  - gold_steel_band
  - steel_band
  - gold_steel_color
  - steel_band_color
  - gold_steel_clasp
  - steel_clasp
  - gold_steel
  - steel
  - gold_steel_bezel
  - steel_bezel

Fuzzy matches:
  - steel
  - steel_band
  - gold_steel
  - steel_clasp
  - steel_bezel

This output shows the best filter keys matching the query 'steel', divided into Direct matches (exact or close matches) and Fuzzy matches (similar but not exact matches). Use these filter keys to refine your watch search in chrono24.

Attributes

The chrono24 instance offers public attributes:

  • count: Total number of listings found.
  • url: URL of listings page.
import chrono24

rolex_dj = chrono24.query("Rolex DateJust")

rolex_dj.count
# >>> 35582
rolex_dj.url
# >>> 'https://www.chrono24.com/rolex/datejust--mod45.htm?dosearch=true&query=Rolex+DateJust'

Exceptions

The chrono24 package handles specific exceptions that might occur during its use:

  • NoListingsFoundException: Raised when no listings are found.
  • RequestException: Raised when a request error occurs or repeated requests fail.
import chrono24
from chrono24.exceptions import NoListingsFoundException, RequestException

try:
    invalid_query = chrono24.query("Invalid Query")
except NoListingsFoundException:
    # In cases where no listings match the provided query
    print("No listings were found.")
except RequestException:
    # In cases where a request error occurs or repeated requests fail
    print("Request error or repeated requests failed.")

Contribute

Support

If you are having issues or would like to propose a new feature, please use the issues tracker.

License

This project is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chrono24-0.3.2.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

chrono24-0.3.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file chrono24-0.3.2.tar.gz.

File metadata

  • Download URL: chrono24-0.3.2.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for chrono24-0.3.2.tar.gz
Algorithm Hash digest
SHA256 3fac0b38e98e4764504bfbeab90bf9c0c2874055f4b3561f4ad3854a04e414c9
MD5 c0e1f2ebed2b1580a26a886be1338ef5
BLAKE2b-256 6b644b1f79d490d212cda7240654fd6c8a7048ba3f1bf751237aee059afe1ca8

See more details on using hashes here.

File details

Details for the file chrono24-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: chrono24-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for chrono24-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9522ed9880b69c3322f563217b22b220d6cac4803dbcb4bf898fbc410faffdf9
MD5 df78f9ba0cb10b3e5a0b8ec2c1bd28d6
BLAKE2b-256 dc2a633f5c559928f0bd2c2014cb274ed6932ec528bbdf2c7e87fa8a43b4853e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page