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.1.tar.gz
.
File metadata
- Download URL: pcpartpicker-2.2.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe4be52abe9a1efcfd064ad80e2dab40e9816efe0ab99120d2e8828ee19538b4 |
|
MD5 | 06dc3a97b8b6d0ec3064853c4134a0f7 |
|
BLAKE2b-256 | bdc11191e7c740303559aee5b6eedbce2d26d3fad4e4de9ad02a1b36803cabe0 |
File details
Details for the file pcpartpicker-2.2.1-py3-none-any.whl
.
File metadata
- Download URL: pcpartpicker-2.2.1-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5299e0c77bfc2fe4416dd0e6c971e4910bb03f812144dc89248685d3a83ba678 |
|
MD5 | 3d2326a51019ac4d1c01cd6a7f8259fe |
|
BLAKE2b-256 | d56772fa50bff44923a324a2a708c7bcd8227cb93b2f1e5f7d7a823e05a04ee9 |