-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI using github.com/simonw/click-app (#58)
I want a CLI tool to download any issue from Il Fatto Quotidiano (IFQ) website. Mix the current implementation with https://github.com/simonw/click-app
- Loading branch information
Showing
14 changed files
with
274 additions
and
215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Publish Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
cache-dependency-path: pyproject.toml | ||
- name: Install dependencies | ||
run: | | ||
pip install '.[test]' | ||
- name: Run tests | ||
run: | | ||
python -m pytest | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
environment: release | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
cache: pip | ||
cache-dependency-path: pyproject.toml | ||
- name: Install dependencies | ||
run: | | ||
pip install setuptools wheel build | ||
- name: Build | ||
run: | | ||
python -m build | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test | ||
|
||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: pip | ||
cache-dependency-path: pyproject.toml | ||
- name: Install dependencies | ||
run: | | ||
pip install '.[test]' | ||
- name: Run tests | ||
run: | | ||
python -m pytest | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,68 @@ | ||
# IFQ | ||
# ifq | ||
|
||
Library to download www.ilfattoquotidiano.it issues in PDF. | ||
[![PyPI](https://img.shields.io/pypi/v/ifq.svg)](https://pypi.org/project/ifq/) | ||
[![Changelog](https://img.shields.io/github/v/release/zmoog/ifq?include_prereleases&label=changelog)](https://github.com/zmoog/ifq/releases) | ||
[![Tests](https://github.com/zmoog/ifq/actions/workflows/test.yml/badge.svg)](https://github.com/zmoog/ifq/actions/workflows/test.yml) | ||
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/zmoog/ifq/blob/master/LICENSE) | ||
|
||
```python | ||
from datetime import date | ||
from ifq import Scraper | ||
CLI tool and Python library to download PDF issues of ilfattoquotidiano.it | ||
|
||
username = '' # your ifq username | ||
password = '' # your ifq password | ||
## Installation | ||
|
||
scraper = Scraper(username, password) | ||
Install this tool using `pip`: | ||
|
||
path_to_pdf_file = scraper.download_pdf(date.today()) | ||
```bash | ||
pip install ifq | ||
``` | ||
|
||
## Getting Started | ||
## Usage | ||
|
||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. | ||
Download the IFQ issue for Jan, 2nd 2025: | ||
|
||
### Prerequisites | ||
```sh | ||
# Requires a valid subscription to the newspaper | ||
export IFQ_USERNAME="[your username]" | ||
export IFQ_PASSWORD="[your password]" | ||
|
||
What things you need to install the software and how to install them | ||
$ ifq issues download 2025-01-02 | ||
|
||
``` | ||
Give examples | ||
``` | ||
|
||
### Installing | ||
|
||
A step by step series of examples that tell you how to get a development env running | ||
Downloading issue for 2025-01-02 00:00:00 to /Users/zmoog/code/projects/zmoog/ifq | ||
Downloaded issue to /Users/zmoog/code/projects/zmoog/ifq/2025-01-02.pdf | ||
|
||
Say what the step will be | ||
|
||
``` | ||
Give the example | ||
$ file 2025-01-02.pdf | ||
2025-01-02.pdf: PDF document, version 1.7 | ||
``` | ||
|
||
And repeat | ||
For help, run: | ||
|
||
``` | ||
until finished | ||
```bash | ||
ifq --help | ||
``` | ||
|
||
End with an example of getting some data out of the system or using it for a little demo | ||
|
||
## Running the tests | ||
|
||
Explain how to run the automated tests for this system | ||
|
||
### Break down into end to end tests | ||
|
||
Explain what these tests test and why | ||
You can also use: | ||
|
||
``` | ||
Give an example | ||
```bash | ||
python -m ifq --help | ||
``` | ||
|
||
### And coding style tests | ||
## Development | ||
|
||
Explain what these tests test and why | ||
To contribute to this tool, first checkout the code. Then create a new virtual environment: | ||
|
||
```bash | ||
cd ifq | ||
python -m venv venv | ||
source venv/bin/activate | ||
``` | ||
Give an example | ||
``` | ||
|
||
## Deployment | ||
|
||
Add additional notes about how to deploy this on a live system | ||
Now install the dependencies and test dependencies: | ||
|
||
## Built With | ||
|
||
* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used | ||
* [Maven](https://maven.apache.org/) - Dependency Management | ||
* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds | ||
|
||
## Contributing | ||
|
||
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. | ||
|
||
## Versioning | ||
|
||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags). | ||
|
||
## Authors | ||
|
||
* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth) | ||
|
||
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details | ||
|
||
## Acknowledgments | ||
```bash | ||
pip install -e '.[test]' | ||
``` | ||
|
||
* Hat tip to anyone whose code was used | ||
* Inspiration | ||
* etc | ||
To run the tests: | ||
|
||
https://gist.github.com/PurpleBooth/109311bb0361f32d87a2 | ||
```bash | ||
python -m pytest | ||
``` |
Oops, something went wrong.