pcpartpicker-flask


Namepcpartpicker-flask JSON
Version 3.1.1 PyPI version JSON
download
home_pagehttps://github.com/carlbeattie2000/pcpartpicker-flask
SummaryA fast, simple API for PCPartPicker.com.
upload_time2024-09-21 13:12:14
maintainerNone
docs_urlNone
authorJonathan Vusich
requires_pythonNone
licenseGPL
keywords pcpartpicker api webscraper python3
VCS
bugtrack_url
requirements py-moneyed dacite aiohttp
Travis-CI
coveralls test coverage
            # pcpartpicker

[![Build Status](https://travis-ci.org/JonathanVusich/pcpartpicker.svg?branch=master)](https://travis-ci.org/JonathanVusich/pcpartpicker)
[![Coverage Status](https://coveralls.io/repos/github/JonathanVusich/pcpartpicker/badge.svg?branch=master&kill_cache=1)](https://coveralls.io/github/JonathanVusich/pcpartpicker?branch=master&kill_cache=1)
![](https://img.shields.io/pypi/dm/pcpartpicker.svg)

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.
```python
pip install pcpartpicker-flask
```

## Examples:
In order to use the API, simply import API from the pcpartpicker package.
```python
from pcpartpicker_flask import API
```
You can then instantiate the API class and use it to make requests.
```python
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:
```python
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:
```python
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):
```python
api = API()
print(api.region)
>>> us
```

Creating an API object with a different default region:
```python
api = API("de")
print(api.region)
>>> de
```

Changing the default region:
```python
api = API()
api.set_region("de")
print(api.region)
>>> de
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/carlbeattie2000/pcpartpicker-flask",
    "name": "pcpartpicker-flask",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pcpartpicker api webscraper python3",
    "author": "Jonathan Vusich",
    "author_email": "jonathanvusich@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/43/a7/7c7682df116f870f9b47984eeebab6eefd65429d81121a6e265d0fd59076/pcpartpicker-flask-3.1.1.tar.gz",
    "platform": null,
    "description": "# pcpartpicker\n\n[![Build Status](https://travis-ci.org/JonathanVusich/pcpartpicker.svg?branch=master)](https://travis-ci.org/JonathanVusich/pcpartpicker)\n[![Coverage Status](https://coveralls.io/repos/github/JonathanVusich/pcpartpicker/badge.svg?branch=master&kill_cache=1)](https://coveralls.io/github/JonathanVusich/pcpartpicker?branch=master&kill_cache=1)\n![](https://img.shields.io/pypi/dm/pcpartpicker.svg)\n\nThis is an unofficial Python 3.7+ API for the website pcpartpicker.com.\nIt is written using asynchronous requests for efficient data retrieval.\nThis package is currently in a stable beta.\n\nUpdated to support flask: Attempts to create a new event loop, which caused\ncrashes when using it with flask and it's event loop\n\n## Installation:\nPackage retrieval and installation can be easily accomplished through pip.\n```python\npip install pcpartpicker-flask\n```\n\n## Examples:\nIn order to use the API, simply import API from the pcpartpicker package.\n```python\nfrom pcpartpicker_flask import API\n```\nYou can then instantiate the API class and use it to make requests.\n```python\napi = API()\ncpu_data = api.retrieve(\"cpu\")\nall_data = api.retrieve_all()\n```\n`api.retrieve()` and `api.retrieve_all()` methods both return a `PartData` instance, which contains a timestamp and a `to_json()` method.\n\nA list of supported parts can be obtained in the following manner:\n```python\napi = API()\nprint(api.supported_parts)\n>>> {'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'}\n```\n\nThere are also a number of methods that can be used in order to customize the API behavior.\nFor example, you can change the region and determine the number of concurrent, asynchronous connections\nthat can be made.\n\nRetrieving supported API regions:\n```python\napi = API()\nprint(api.supported_regions)\n>>> {'be', 'us', 'it', 'uk', 'ie', 'nz', 'de', 'ca', 'au', 'fr', 'se', 'es', 'in'}\n```\n\nRetrieving currently selected region (default is US):\n```python\napi = API()\nprint(api.region)\n>>> us\n```\n\nCreating an API object with a different default region:\n```python\napi = API(\"de\")\nprint(api.region)\n>>> de\n```\n\nChanging the default region:\n```python\napi = API()\napi.set_region(\"de\")\nprint(api.region)\n>>> de\n```\n\n\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "A fast, simple API for PCPartPicker.com.",
    "version": "3.1.1",
    "project_urls": {
        "Homepage": "https://github.com/carlbeattie2000/pcpartpicker-flask"
    },
    "split_keywords": [
        "pcpartpicker",
        "api",
        "webscraper",
        "python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f06786720b58033dc5034213765307179559902288ec09eb2f5206ee68bf560",
                "md5": "60fc77ba3fc19b12704f9211ca64653b",
                "sha256": "ab5ebc54789811b88e32f469c80e1d1be842b38cb1e05cbd248e3cb7a4b39d14"
            },
            "downloads": -1,
            "filename": "pcpartpicker_flask-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60fc77ba3fc19b12704f9211ca64653b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 23636,
            "upload_time": "2024-09-21T13:12:13",
            "upload_time_iso_8601": "2024-09-21T13:12:13.579146Z",
            "url": "https://files.pythonhosted.org/packages/1f/06/786720b58033dc5034213765307179559902288ec09eb2f5206ee68bf560/pcpartpicker_flask-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43a77c7682df116f870f9b47984eeebab6eefd65429d81121a6e265d0fd59076",
                "md5": "578a930d8ee46eefb4a5ebab93b48004",
                "sha256": "849ba56568847655efc727e6af5876fb9b9270e8b47df586b1e3ccfc06d617e9"
            },
            "downloads": -1,
            "filename": "pcpartpicker-flask-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "578a930d8ee46eefb4a5ebab93b48004",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22228,
            "upload_time": "2024-09-21T13:12:14",
            "upload_time_iso_8601": "2024-09-21T13:12:14.997158Z",
            "url": "https://files.pythonhosted.org/packages/43/a7/7c7682df116f870f9b47984eeebab6eefd65429d81121a6e265d0fd59076/pcpartpicker-flask-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-21 13:12:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "carlbeattie2000",
    "github_project": "pcpartpicker-flask",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "py-moneyed",
            "specs": [
                [
                    "==",
                    "0.8.0"
                ]
            ]
        },
        {
            "name": "dacite",
            "specs": [
                [
                    "==",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.7.4"
                ]
            ]
        }
    ],
    "lcname": "pcpartpicker-flask"
}
        
Elapsed time: 1.04541s