A fast, simple API for PCPartPicker.com.
Project description
pcpartpicker
This is an unofficial Python 3.7+ API for the website pcpartpicker.com. It is written using asynchronous requests for efficient data retrieval. This package is currently in a stable beta.
Installation:
Package retrieval and installation can be easily accomplished through pip.
pip install pcpartpicker
Examples:
In order to use the API, simply import API from the pcpartpicker package.
from pcpartpicker import API
You can then instantiate the API class and use it to make requests.
api = API()
cpu_data = api.retrieve("cpu")
all_data = api.retrieve_all()
api.retrieve()
and api.retrieve_all()
methods both return a PartData
instance, which contains a timestamp and a to_json()
method.
A list of supported parts can be obtained in the following manner:
api = API()
print(api.supported_parts)
>>> {'wireless-network-card', 'case-fan', 'cpu', 'cpu-cooler', 'headphones', 'motherboard', 'monitor', 'internal-hard-drive', 'external-hard-drive', 'ups', 'fan-controller', 'case', 'keyboard', 'mouse', 'wired-network-card', 'sound-card', 'video-card', 'speakers', 'optical-drive', 'power-supply', 'thermal-paste', 'memory'}
There are also a number of methods that can be used in order to customize the API behavior. For example, you can change the region, determine the number of concurrent, asynchronous connections that can be made, and can also set whether or not the API can use multiple threads.
Retrieving supported API regions:
api = API()
print(api.supported_regions)
>>> {'be', 'us', 'it', 'uk', 'ie', 'nz', 'de', 'ca', 'au', 'fr', 'se', 'es', 'in'}
Retrieving currently selected region (default is US):
api = API()
print(api.region)
>>> us
Creating an API object with a different default region:
api = API("de")
print(api.region)
>>> de
Changing the default region:
api = API()
api.set_region("de")
print(api.region)
>>> de
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pcpartpicker-2.2.2.tar.gz
.
File metadata
- Download URL: pcpartpicker-2.2.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c7561329e6c082104f7f1eef43f90ec62251461cfcbe6040228b026a68c2ca0 |
|
MD5 | fb90347a32976bd76cefb2957d55fe38 |
|
BLAKE2b-256 | 1efebb7bd1139bea09786fa1e21f2e2365a216a3cc023342ccd88965a094a49d |
File details
Details for the file pcpartpicker-2.2.2-py3-none-any.whl
.
File metadata
- Download URL: pcpartpicker-2.2.2-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ec5b4200b347abd65c97501f9ac7bb16ffd701e4bffdba276ebacf3782e185 |
|
MD5 | 61c9f8f6b2d9289c5b13eaf826e8b5be |
|
BLAKE2b-256 | 4539a26e90285958ff3747ba2f67b9cbd18402f532e1b4134264dc7d26ea0398 |