dump-things-pyclient 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/PKG-INFO +1 -1
- dump_things_pyclient-0.1.2/dump_things_pyclient/commands/post_records.py +59 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/communicate.py +1 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/PKG-INFO +1 -1
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/SOURCES.txt +1 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/entry_points.txt +1 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/pyproject.toml +2 -1
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/README.md +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/__init__.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/__init__.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/auto_curate.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/get_records.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/json2ttl.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/read_pages.py +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/dependency_links.txt +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/requires.txt +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/top_level.txt +0 -0
- {dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from ..communicate import (
|
|
9
|
+
collection_write_record,
|
|
10
|
+
curated_write_record,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
argument_parser = argparse.ArgumentParser()
|
|
16
|
+
argument_parser.add_argument('base_url')
|
|
17
|
+
argument_parser.add_argument('collection')
|
|
18
|
+
argument_parser.add_argument('cls', metavar='class')
|
|
19
|
+
argument_parser.add_argument('--curated', action='store_true', help='bypass inbox, requires curator token')
|
|
20
|
+
|
|
21
|
+
arguments = argument_parser.parse_args()
|
|
22
|
+
|
|
23
|
+
token = os.environ.get('DUMPTHINGS_TOKEN')
|
|
24
|
+
if token is None:
|
|
25
|
+
print(
|
|
26
|
+
'WARNING: environment variable DUMPTHINGS_TOKEN not set',
|
|
27
|
+
file=sys.stderr,
|
|
28
|
+
flush=True,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
if arguments.curated:
|
|
32
|
+
write_record = curated_write_record
|
|
33
|
+
else:
|
|
34
|
+
write_record = collection_write_record
|
|
35
|
+
|
|
36
|
+
posted = False
|
|
37
|
+
for line in sys.stdin:
|
|
38
|
+
record = json.loads(line)
|
|
39
|
+
try:
|
|
40
|
+
write_record(
|
|
41
|
+
service_url=arguments.base_url,
|
|
42
|
+
collection=arguments.collection,
|
|
43
|
+
class_name=arguments.cls,
|
|
44
|
+
record=record,
|
|
45
|
+
token=token,
|
|
46
|
+
)
|
|
47
|
+
except Exception as e:
|
|
48
|
+
print(f'Error: {e}', file=sys.stderr, flush=True)
|
|
49
|
+
else:
|
|
50
|
+
posted = True
|
|
51
|
+
print('.', end='', flush=True)
|
|
52
|
+
|
|
53
|
+
if posted:
|
|
54
|
+
# final newline
|
|
55
|
+
print('')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == '__main__':
|
|
59
|
+
sys.exit(main())
|
{dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/SOURCES.txt
RENAMED
|
@@ -12,4 +12,5 @@ dump_things_pyclient/commands/__init__.py
|
|
|
12
12
|
dump_things_pyclient/commands/auto_curate.py
|
|
13
13
|
dump_things_pyclient/commands/get_records.py
|
|
14
14
|
dump_things_pyclient/commands/json2ttl.py
|
|
15
|
+
dump_things_pyclient/commands/post_records.py
|
|
15
16
|
dump_things_pyclient/commands/read_pages.py
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
auto-curate = dump_things_pyclient.commands.auto_curate:main
|
|
3
3
|
get-records = dump_things_pyclient.commands.get_records:main
|
|
4
4
|
json2ttl = dump_things_pyclient.commands.json2ttl:main
|
|
5
|
+
post-records = dump_things_pyclient.commands.post_records:main
|
|
5
6
|
read-pages = dump_things_pyclient.commands.read_pages:main
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dump-things-pyclient"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "A client library and some CLI command for dump-things-services"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -22,3 +22,4 @@ auto-curate = "dump_things_pyclient.commands.auto_curate:main"
|
|
|
22
22
|
read-pages = "dump_things_pyclient.commands.read_pages:main"
|
|
23
23
|
get-records = "dump_things_pyclient.commands.get_records:main"
|
|
24
24
|
json2ttl = "dump_things_pyclient.commands.json2ttl:main"
|
|
25
|
+
post-records = "dump_things_pyclient.commands.post_records:main"
|
|
File without changes
|
|
File without changes
|
{dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient/commands/json2ttl.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dump_things_pyclient-0.1.1 → dump_things_pyclient-0.1.2}/dump_things_pyclient.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|