Skip to content

Commit

Permalink
Convert print statements to logging
Browse files Browse the repository at this point in the history
  • Loading branch information
s2t2 committed Oct 2, 2023
1 parent 299cc58 commit b773932
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ poetry shell
truthbrush --help # will use your local copy of truthbrush
```

To run the tests:

```sh
pytest
```

If you prefer not to install Poetry in your root environment, you can also use Conda:

Expand All @@ -106,8 +101,17 @@ conda install -c conda-forge poetry
poetry install
```

To run the tests:

```sh
pytest

# optionally run tests with verbose logging outputs:
pytest --log-cli-level=DEBUG -s
```

Please format your code with `black`:

```sh
black .
```
Expand Down
8 changes: 4 additions & 4 deletions truthbrush/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ def pull_statuses(
if not replies:
url += "?exclude_replies=true"
if verbose:
print("--------------------------")
print(url, params)
logger.debug("--------------------------")
logger.debug(f"{url} {params}")
result = self._get(url, params=params)
page_counter += 1
except json.JSONDecodeError as e:
Expand Down Expand Up @@ -312,7 +312,7 @@ def pull_statuses(
] # when pulling the next page, get posts before this (the oldest)

if verbose:
print("PAGE", page_counter)
logger.debug(f"PAGE: {page_counter}")

for post in posts:
post["_pulled"] = datetime.now().isoformat()
Expand All @@ -330,7 +330,7 @@ def pull_statuses(
break # do not yeild this post or remaining (older) posts on this page

if verbose:
print(post["id"], post["created_at"])
logger.debug(f"{post['id']} {post['created_at']}")

yield post

Expand Down

0 comments on commit b773932

Please sign in to comment.