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.
Updated to support flask: Attempts to create a new event loop, which caused crashes when using it with flask and it's event loop
Installation:
Package retrieval and installation can be easily accomplished through pip.
pip install pcpartpicker-flask
Examples:
In order to use the API, simply import API from the pcpartpicker package.
from pcpartpicker_flask 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 and determine the number of concurrent, asynchronous connections that can be made.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pcpartpicker-flask-3.1.1.tar.gz.
File metadata
- Download URL: pcpartpicker-flask-3.1.1.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
849ba56568847655efc727e6af5876fb9b9270e8b47df586b1e3ccfc06d617e9
|
|
| MD5 |
578a930d8ee46eefb4a5ebab93b48004
|
|
| BLAKE2b-256 |
43a77c7682df116f870f9b47984eeebab6eefd65429d81121a6e265d0fd59076
|
File details
Details for the file pcpartpicker_flask-3.1.1-py3-none-any.whl.
File metadata
- Download URL: pcpartpicker_flask-3.1.1-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab5ebc54789811b88e32f469c80e1d1be842b38cb1e05cbd248e3cb7a4b39d14
|
|
| MD5 |
60fc77ba3fc19b12704f9211ca64653b
|
|
| BLAKE2b-256 |
1f06786720b58033dc5034213765307179559902288ec09eb2f5206ee68bf560
|