-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #917 from internetarchive/check_url_archive
functionality is sufficient to merge with main branch. check-url-archive endpoint was added
- Loading branch information
Showing
30 changed files
with
686 additions
and
430 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -12,4 +12,5 @@ __pycache__/ | |
.coverage | ||
.idea/ | ||
venv/ | ||
_notes/ | ||
_notes/ | ||
.env |
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,7 +1,6 @@ | ||
[tool.poetry] | ||
name = "Internet Archive Reference Inventory (IARI)" | ||
#name = "IARI" | ||
version = "4.1.4" | ||
version = "4.2.0" | ||
description = "API capable of fetching, extracting, transforming and storing reference information from Wikipedia articles, websites and PDFs as structured data." | ||
authors = ["Dennis Priskorn <[email protected]>"] | ||
license = "GPLv3+" | ||
|
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# get_version.py | ||
|
||
|
||
def get_poetry_version(file_path): | ||
with open(file_path) as toml_file: | ||
content = toml_file.read() | ||
|
||
poetry_start = content.find("[tool.poetry]") | ||
if poetry_start == -1: | ||
return None # The [tool.poetry] section is not found | ||
|
||
version_start = content.find("version", poetry_start) | ||
if version_start == -1: | ||
return None # The 'version' property is not found in [tool.poetry] | ||
|
||
version_end = content.find("\n", version_start) | ||
version_line = content[version_start:version_end].strip() | ||
|
||
# Assuming version is in the format 'version = "x.y.z"' | ||
version = version_line.split("=")[1].strip().strip('"') | ||
|
||
return version |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from urllib.parse import unquote | ||
|
||
from src.models.api.job import Job | ||
|
||
|
||
class UrlArchiveJob(Job): | ||
url: str | ||
|
||
@property | ||
def unquoted_url(self): | ||
"""Decoded url""" | ||
return unquote(self.url) |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import logging | ||
|
||
from marshmallow import post_load | ||
from marshmallow.fields import Bool, Int, String | ||
|
||
from src.models.api.job.check_url_archive_job import UrlArchiveJob | ||
from src.models.api.schema.refresh import BaseSchema | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class UrlArchiveSchema(BaseSchema): | ||
"""This validates the patron input in the get request""" | ||
|
||
url = String(required=True) | ||
|
||
# noinspection PyUnusedLocal | ||
@post_load | ||
# **kwargs is needed here despite what the validator claims | ||
def return_object(self, data, **kwargs) -> UrlArchiveJob: # type: ignore # dead: disable | ||
"""Return job object""" | ||
from src import app | ||
|
||
app.logger.debug("return_object: running") | ||
job = UrlArchiveJob(**data) | ||
return job |
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
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
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,11 @@ | ||
import logging | ||
from typing import Any, Dict, Optional | ||
|
||
from src.models.file_io.hash_based import HashBasedFileIo | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class UrlArchiveFileIo(HashBasedFileIo): | ||
data: Optional[Dict[str, Any]] = None | ||
subfolder = "urls/archives/" |
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
|
||
class UrlFileIo(HashBasedFileIo): | ||
data: Optional[Dict[str, Any]] = None | ||
flavor: str = "" | ||
subfolder = "urls/" |
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
Oops, something went wrong.