Skip to content

Commit

Permalink
Publish on PyPI (#37)
Browse files Browse the repository at this point in the history
* Rename bin script

* Install bin script from pypi

* Update README with example and contributors

* Small improvement

* Put more emphasis on the CLI usage

* Bump version to 0.5.0
  • Loading branch information
Maurizio Branca authored Dec 30, 2020
1 parent 3a0b3d3 commit dc88ac9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pytest = "6.2.1"
requests = "==2.25.1"
beautifulsoup4 = "==4.9.3"
price-parser = "==0.3.4"
click = "7.1.2"
click = "==7.1.2"
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
# Refurbished

Python library to access the products information available on the Apple Certified Refurbished section of the Apple Store.
Python library and CLI tool to access the products information available on the Apple Certified Refurbished section of the Apple Store.

# Usage
## Usage

Refurbished can be used as a library or as a handly CLI tool to search for refurbished products from the terminal.

### CLI

A quick search for Macs with a min saving or 300 EUR on the Italian store:

```shell
$ rfrb it macs --min-saving=300

1979.00 1679.00 300.00 (15.159171298635673%) MacBook Pro 13,3" ricondizionato con Intel Core i5 quad‐core a 2,4GHz e display Retina - Grigio siderale
2229.00 1889.00 340.00 (15.25347689546882%) MacBook Pro 13,3" ricondizionato con Intel Core i5 quad-core a 2,0GHz e display Retina - Argento
2229.00 1889.00 340.00 (15.25347689546882%) MacBook Pro 13,3" ricondizionato con Intel Core i5 quad‐core a 2,0GHz e display Retina - Grigio siderale
2459.00 2109.00 350.00 (14.233428222854819%) MacBook Pro 13,3" ricondizionato con Intel Core i5 quad-core a 2,0GHz e display Retina - Argento
```

### Library

The same search using the `refurbished` package in your own project:

```python
>>>
>>> from refurbished import Store
>>> store = Store('it')
>>> macs = store.get_macs()
>>> [mac for mac in macs if mac.savings_price > 400]
[Product(name='MacBook\xa0Pro 15,4" ricondizionato con Intel Core i9 8-core a 2,3GHz e display Retina - Grigio siderale', price=Decimal('2619.00'), previous_price=Decimal('3079.00'), savings_price=Decimal('460.00'))]
>>>
>>> for mac in store.get_macs(min_saving=300):
... print(mac.name, mac.price)
...
MacBook Pro 13,3" ricondizionato con Intel Core i5 quad‐core a 2,4GHz e display Retina - Grigio siderale 1679.00
MacBook Pro 13,3" ricondizionato con Intel Core i5 quad-core a 2,0GHz e display Retina - Argento 1889.00
MacBook Pro 13,3" ricondizionato con Intel Core i5 quad‐core a 2,0GHz e display Retina - Grigio siderale 1889.00
MacBook Pro 13,3" ricondizionato con Intel Core i5 quad-core a 2,0GHz e display Retina - Argento 2109.00
```

## Development
### Prerequisites

You need to install the following tools:
Expand All @@ -21,7 +47,7 @@ You need to install the following tools:
* [Pipenv](https://pipenv.kennethreitz.org/en/latest/) — tested with version 2018.11.26, it's used to streamline development in Python projects.


### Installing
### Checkout

A step by step series of steps that tell you how to get a development env running.

Expand Down Expand Up @@ -105,6 +131,7 @@ We use [SemVer](http://semver.org/) for versioning. For the versions available,
## Authors

* **Maurizio Branca** - *Initial work* - [zmoog](https://github.com/zmoog)
* **Yizhou "Andi" Cui** - *Improved parser* - [AndiCui](https://github.com/AndiCui)

## License

Expand Down
2 changes: 1 addition & 1 deletion cli/rfrb.py → cli/rfrb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! env python
#!/usr/bin/env python
import click

from refurbished import Store
Expand Down
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
long_description = f.read()

NAME = "refurbished"
REQUIRES = ["beautifulsoup4 >= 4.9.3", "requests >= 2.25.1", "price-parser == 0.3.4"]
REQUIRES = [
"beautifulsoup4 >= 4.9.3",
"requests >= 2.25.1",
"price-parser == 0.3.4",
"click == 7.1.2"
]

setup(
name=NAME,
version="0.2.0",
description="library to search refurbished products on the Apple Store",
version="0.5.0",
description="Library to search refurbished products on the Apple Store",
author="Maurizio Branca",
author_email="[email protected]",
url="https://github.com/zmoog/refurbished",
scripts=['cli/rfrb'],
keywords=[],
install_requires=REQUIRES,
packages=find_packages(exclude=["test", "tests"]),
Expand Down

0 comments on commit dc88ac9

Please sign in to comment.