Skip to content

Commit

Permalink
Merge pull request #84 from rseng/fix/csv-sheet-import
Browse files Browse the repository at this point in the history
allowing csv export to use custom parser
  • Loading branch information
vsoch authored Sep 23, 2022
2 parents 5982054 + 00e2446 commit 6343330
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip.

## [0.0.x](https://github.com/rseng/rse/tree/master) (0.0.x)
- allow custom import for csv and google-sheet (0.0.47)
- support for csv import (0.0.46)
- ensure Google scraper skips malformed rows, etc (0.0.45)
- Logging bugs and adding export/import docs (0.0.44)
Expand Down
23 changes: 10 additions & 13 deletions rse/main/scrapers/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,23 @@ def create(self, database=None, config_file=None, update=False):
uid = result["url"].split("//")[-1]

# If a repository is added that isn't represented
try:
repo = get_parser(uid)
data = repo.get_metadata()

# Empty or malformed repository
if not data:
bot.warning(f"Skipping malformed entry {uid}")
continue
result = update_nonempty(result, data)

# Or as custom entry
except NotImplementedError:
# Base UID based on title
repo = get_parser(uid)
data = repo.get_metadata() or {}

# Empty or malformed repository
if not data and repo.name == "custom":
repo = CustomParser(result["title"])
repo.set_metadata(
title=result["title"],
url=result["url"],
description=result["description"],
)

elif not data:
bot.warning(f"Skipping malformed entry {uid}")
continue
result = update_nonempty(result, data)

# Add results that don't exist
exists = client.exists(repo.uid)
if not exists:
Expand Down
2 changes: 1 addition & 1 deletion rse/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""


__version__ = "0.0.46"
__version__ = "0.0.47"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "vsoch@users.noreply.github.io"
NAME = "rse"
Expand Down

0 comments on commit 6343330

Please sign in to comment.