Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab9f996174 | ||
| de78753675 | |||
|
|
7b7fd1e2bb | ||
| 4eda0fb5cc | |||
|
|
fa43080602 | ||
| 15ae1143a5 | |||
|
|
efbe04df6d | ||
| 22b3062c49 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
||||
|
||||
<!--next-version-placeholder-->
|
||||
|
||||
## v0.5.4 (2022-07-05)
|
||||
### Fix
|
||||
* Pass headers through KeyedWriterFactory ([`de78753`](https://git.grassecon.net/cicnet/cic-cli/commit/de78753675242dd253359a5a5601d9062d81f0ee))
|
||||
|
||||
## v0.5.3 (2022-07-05)
|
||||
### Fix
|
||||
* Add auth headers to HTTPWriter ([`4eda0fb`](https://git.grassecon.net/cicnet/cic-cli/commit/4eda0fb5cc2c41a735619dc3e34f21c4e27fd112))
|
||||
|
||||
## v0.5.2 (2022-07-05)
|
||||
### Fix
|
||||
* Bump cic-types ([`15ae114`](https://git.grassecon.net/cicnet/cic-cli/commit/15ae1143a5230078219072d096741546ebcc3d07))
|
||||
|
||||
## v0.5.1 (2022-07-05)
|
||||
### Fix
|
||||
* Upgrade cic-types to support meta auth ([`22b3062`](https://git.grassecon.net/cicnet/cic-cli/commit/22b3062c4909400664bd2a50ca36d5ee737531a1))
|
||||
|
||||
## v0.5.0 (2022-07-04)
|
||||
### Feature
|
||||
* Add meta-auth ([#4](https://git.grassecon.net/cicnet/cic-cli/issues/4)) ([`bfe7086`](https://git.grassecon.net/cicnet/cic-cli/commit/bfe7086178f3fc2743dd68cc20c5459ca466ae8e))
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.5.0"
|
||||
__version__ = "0.5.4"
|
||||
|
||||
@@ -7,8 +7,6 @@ from typing import List
|
||||
# External imports
|
||||
from chainlib.chain import ChainSpec
|
||||
from chainlib.cli.config import Config
|
||||
from cic_types.ext.metadata import MetadataRequestsHandler
|
||||
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
||||
|
||||
# Local Modules
|
||||
from cic.contract.components.attachment import Attachment
|
||||
@@ -19,7 +17,8 @@ from cic.contract.helpers import init_writers_from_config
|
||||
from cic.contract.network import Network
|
||||
from cic.contract.processor import ContractProcessor
|
||||
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
|
||||
|
||||
from cic_types.ext.metadata import MetadataRequestsHandler
|
||||
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -149,7 +148,7 @@ def deploy_contract(
|
||||
|
||||
metadata_endpoint = config.get("META_URL")
|
||||
metadata_auth_token = config.get("META_AUTH_TOKEN")
|
||||
|
||||
headers = {"Authorization": f"Basic {metadata_auth_token}"}
|
||||
if metadata_endpoint is not None:
|
||||
MetadataRequestsHandler.base_url = metadata_endpoint
|
||||
MetadataRequestsHandler.auth_token = metadata_auth_token
|
||||
@@ -168,12 +167,12 @@ def deploy_contract(
|
||||
)
|
||||
ca = Attachment(
|
||||
path=contract_directory,
|
||||
writer=writers["attachment"](path=output_writer_path_meta),
|
||||
writer=writers["attachment"](path=output_writer_path_meta, headers=headers),
|
||||
)
|
||||
cp = Proof(
|
||||
path=contract_directory,
|
||||
attachments=ca,
|
||||
writer=writers["proof"](path=output_writer_path_meta),
|
||||
writer=writers["proof"](path=output_writer_path_meta, headers=headers),
|
||||
)
|
||||
cn = Network(path=contract_directory)
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ class ContractProcessor:
|
||||
if a is None:
|
||||
logg.debug(f'skipping missing task receiver "{task}"')
|
||||
continue
|
||||
logg.debug(f'Processing "{ext}:{task}"')
|
||||
v = a.process(
|
||||
token_address=token_address,
|
||||
token_symbol=token_symbol,
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
import urllib.request
|
||||
from typing import Type, Union
|
||||
from typing import Dict, Type, Union
|
||||
|
||||
from cic_types.ext.metadata import MetadataPointer, MetadataRequestsHandler
|
||||
|
||||
@@ -33,6 +33,7 @@ class KVWriter(OutputWriter):
|
||||
os.makedirs(path)
|
||||
self.path = path
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def write(self, k, v):
|
||||
fp = os.path.join(self.path, str(k))
|
||||
logg.debug(f"path write {fp} {str(v)}")
|
||||
@@ -42,16 +43,17 @@ class KVWriter(OutputWriter):
|
||||
|
||||
|
||||
class HTTPWriter(OutputWriter):
|
||||
def __init__(self, path=None, *args, **kwargs):
|
||||
def __init__(self, path=None, headers: Dict[str, str] = None, *args, **kwargs):
|
||||
super(HTTPWriter, self).__init__(*args, **kwargs)
|
||||
self.path = path
|
||||
self.headers = headers
|
||||
|
||||
def write(self, k, v):
|
||||
path = self.path
|
||||
if k is not None:
|
||||
path = os.path.join(path, k)
|
||||
logg.debug(f"http writer post {path} \n key: {k}, value: {v}")
|
||||
rq = urllib.request.Request(path, method="POST", data=v)
|
||||
logg.debug(f"HTTPWriter POST {path} data: {v}, headers: {self.headers}")
|
||||
rq = urllib.request.Request(path, method="POST", data=v, headers=self.headers)
|
||||
r = urllib.request.urlopen(rq)
|
||||
logg.info(f"http writer submitted at {r.read()}")
|
||||
|
||||
@@ -83,13 +85,15 @@ class KeyedWriterFactory:
|
||||
logg.debug(f"adding key {k} t keyed writer factory")
|
||||
self.x[k] = v
|
||||
|
||||
def new(self, path=None, *_args, **_kwargs):
|
||||
def new(self, path=None, headers: Dict[str, str] = None, *_args, **_kwargs):
|
||||
writer_keyed = None
|
||||
writer_immutable = None
|
||||
if self.key_writer_constructor is not None:
|
||||
writer_keyed = self.key_writer_constructor(path, **self.x)
|
||||
if self.immutable_writer_constructor is not None:
|
||||
writer_immutable = self.immutable_writer_constructor(path, **self.x)
|
||||
writer_immutable = self.immutable_writer_constructor(
|
||||
path, headers, **self.x
|
||||
)
|
||||
return KeyedWriter(writer_keyed, writer_immutable)
|
||||
|
||||
|
||||
|
||||
97
poetry.lock
generated
97
poetry.lock
generated
@@ -227,11 +227,11 @@ reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "charset-normalizer"
|
||||
version = "2.0.12"
|
||||
version = "2.1.0"
|
||||
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.5.0"
|
||||
python-versions = ">=3.6.0"
|
||||
|
||||
[package.extras]
|
||||
unicode_backport = ["unicodedata2"]
|
||||
@@ -286,20 +286,19 @@ reference = "grassroots_"
|
||||
|
||||
[[package]]
|
||||
name = "cic-types"
|
||||
version = "0.2.2"
|
||||
version = "0.2.7"
|
||||
description = "Defines descriptors for data objects specific to the CIC-Network."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
python-versions = ">=3.8,<4.0"
|
||||
|
||||
[package.dependencies]
|
||||
chainlib-eth = ">=0.1.0,<0.2.0"
|
||||
jsonschema = "3.2.0"
|
||||
phonenumbers = "8.12.12"
|
||||
python-gnupg = "0.4.7"
|
||||
requests = "2.26.0"
|
||||
semver = "2.13.0"
|
||||
vobject = "0.9.6.1"
|
||||
jsonschema = ">=4.6.0,<5.0.0"
|
||||
phonenumbers = ">=8.12.50,<9.0.0"
|
||||
python-gnupg = ">=0.4.9,<0.5.0"
|
||||
requests = ">=2.28.0,<3.0.0"
|
||||
vobject = ">=0.9.6,<0.10.0"
|
||||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
@@ -906,6 +905,26 @@ type = "legacy"
|
||||
url = "https://pypi.org/simple"
|
||||
reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "importlib-resources"
|
||||
version = "5.8.0"
|
||||
description = "Read resources from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""}
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
|
||||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
url = "https://pypi.org/simple"
|
||||
reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "1.1.1"
|
||||
@@ -983,20 +1002,20 @@ reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema"
|
||||
version = "3.2.0"
|
||||
version = "4.6.1"
|
||||
description = "An implementation of JSON Schema validation for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
attrs = ">=17.4.0"
|
||||
pyrsistent = ">=0.14.0"
|
||||
six = ">=1.11.0"
|
||||
importlib-resources = {version = ">=1.4.0", markers = "python_version < \"3.9\""}
|
||||
pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2"
|
||||
|
||||
[package.extras]
|
||||
format = ["idna", "jsonpointer (>1.13)", "rfc3987", "strict-rfc3339", "webcolors"]
|
||||
format_nongpl = ["idna", "jsonpointer (>1.13)", "webcolors", "rfc3986-validator (>0.1.0)", "rfc3339-validator"]
|
||||
format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"]
|
||||
format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"]
|
||||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
@@ -1174,7 +1193,7 @@ reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "phonenumbers"
|
||||
version = "8.12.12"
|
||||
version = "8.12.51"
|
||||
description = "Python version of Google's common library for parsing, formatting, storing and validating international phone numbers."
|
||||
category = "main"
|
||||
optional = false
|
||||
@@ -1528,7 +1547,7 @@ reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "python-gnupg"
|
||||
version = "0.4.7"
|
||||
version = "0.4.9"
|
||||
description = "A wrapper for the Gnu Privacy Guard (GPG or GnuPG)"
|
||||
category = "main"
|
||||
optional = false
|
||||
@@ -1606,21 +1625,21 @@ reference = "pypi_"
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.26.0"
|
||||
version = "2.28.1"
|
||||
description = "Python HTTP for Humans."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
||||
python-versions = ">=3.7, <4"
|
||||
|
||||
[package.dependencies]
|
||||
certifi = ">=2017.4.17"
|
||||
charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""}
|
||||
idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""}
|
||||
charset-normalizer = ">=2,<3"
|
||||
idna = ">=2.5,<4"
|
||||
urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
|
||||
use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"]
|
||||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
@@ -1720,7 +1739,7 @@ reference = "pypi_"
|
||||
name = "semver"
|
||||
version = "2.13.0"
|
||||
description = "Python helper for Semantic Versioning (http://semver.org/)"
|
||||
category = "main"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
@@ -2008,7 +2027,7 @@ reference = "pypi_"
|
||||
name = "zipp"
|
||||
version = "3.8.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
category = "dev"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
@@ -2027,7 +2046,7 @@ eth = ["chainlib-eth", "eth-token-index", "eth-address-index", "okota", "cic-eth
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "bd91182211f1eec9ae17d392b8500e0c54035b4fb65d8c0f95241161d0b75878"
|
||||
content-hash = "1379242725006a2a94a6c7cf2a6924a1a117803b6898f0bcea88c9ff760a7e87"
|
||||
|
||||
[metadata.files]
|
||||
asn1crypto = [
|
||||
@@ -2200,8 +2219,8 @@ chainlib-eth = [
|
||||
{file = "chainlib-eth-0.1.2.tar.gz", hash = "sha256:3f1d115821fa179285086fede346b04d194e3ad77505adf20672a377ce369879"},
|
||||
]
|
||||
charset-normalizer = [
|
||||
{file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"},
|
||||
{file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"},
|
||||
{file = "charset-normalizer-2.1.0.tar.gz", hash = "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"},
|
||||
{file = "charset_normalizer-2.1.0-py3-none-any.whl", hash = "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5"},
|
||||
]
|
||||
cic-contracts = []
|
||||
cic-eth-registry = []
|
||||
@@ -2390,6 +2409,10 @@ importlib-metadata = [
|
||||
{file = "importlib_metadata-4.12.0-py3-none-any.whl", hash = "sha256:7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23"},
|
||||
{file = "importlib_metadata-4.12.0.tar.gz", hash = "sha256:637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670"},
|
||||
]
|
||||
importlib-resources = [
|
||||
{file = "importlib_resources-5.8.0-py3-none-any.whl", hash = "sha256:7952325ffd516c05a8ad0858c74dff2c3343f136fe66a6002b2623dd1d43f223"},
|
||||
{file = "importlib_resources-5.8.0.tar.gz", hash = "sha256:568c9f16cb204f9decc8d6d24a572eeea27dacbb4cee9e6b03a8025736769751"},
|
||||
]
|
||||
iniconfig = [
|
||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
|
||||
@@ -2411,8 +2434,8 @@ json-rpc = [
|
||||
{file = "json_rpc-1.13.0-py2.py3-none-any.whl", hash = "sha256:84b45058e5ba95f49c7b6afcf7e03ab86bee89bf2c01f3ad8dd41fe114fc1f84"},
|
||||
]
|
||||
jsonschema = [
|
||||
{file = "jsonschema-3.2.0-py2.py3-none-any.whl", hash = "sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163"},
|
||||
{file = "jsonschema-3.2.0.tar.gz", hash = "sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a"},
|
||||
{file = "jsonschema-4.6.1-py3-none-any.whl", hash = "sha256:5eb781753403847fb320f05e9ab2191725b58c5e7f97f1bed63285ca423159bc"},
|
||||
{file = "jsonschema-4.6.1.tar.gz", hash = "sha256:ec2802e6a37517f09d47d9ba107947589ae1d25ff557b925d83a321fc2aa5d3b"},
|
||||
]
|
||||
keyring = [
|
||||
{file = "keyring-23.6.0-py3-none-any.whl", hash = "sha256:372ff2fc43ab779e3f87911c26e6c7acc8bb440cbd82683e383ca37594cb0617"},
|
||||
@@ -2506,8 +2529,8 @@ pathspec = [
|
||||
{file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"},
|
||||
]
|
||||
phonenumbers = [
|
||||
{file = "phonenumbers-8.12.12-py2.py3-none-any.whl", hash = "sha256:23944f9e628f32a975d3b221b6d76e6ba8ae618d53cb3d82fc23d9e100a59b29"},
|
||||
{file = "phonenumbers-8.12.12.tar.gz", hash = "sha256:70aa98a50ba7bc7f6bf17851f806c927107e7c44e7d21eb46bdbec07b99d23ae"},
|
||||
{file = "phonenumbers-8.12.51-py2.py3-none-any.whl", hash = "sha256:ac13b944e18ecb3ad58d9a090a2053dfe3d30dbe3711ebc2945a461b855ad4bf"},
|
||||
{file = "phonenumbers-8.12.51.tar.gz", hash = "sha256:9d4a9460127ffd288ae071dd1f7942e2329da5b5c5d57d8aabe7103427ca7cbf"},
|
||||
]
|
||||
pkginfo = [
|
||||
{file = "pkginfo-1.8.3-py2.py3-none-any.whl", hash = "sha256:848865108ec99d4901b2f7e84058b6e7660aae8ae10164e015a6dcf5b242a594"},
|
||||
@@ -2650,8 +2673,8 @@ python-gitlab = [
|
||||
{file = "python_gitlab-3.6.0-py3-none-any.whl", hash = "sha256:b855c15e106812a4ada7c4d417def61bc211976bbf2ee1c7e0cd48a83eca4e9f"},
|
||||
]
|
||||
python-gnupg = [
|
||||
{file = "python-gnupg-0.4.7.tar.gz", hash = "sha256:2061f56b1942c29b92727bf9aecbd3cea3893acc9cccbdc7eb4604285efe4ac7"},
|
||||
{file = "python_gnupg-0.4.7-py2.py3-none-any.whl", hash = "sha256:3ff5b1bf5e397de6e1fe41a7c0f403dad4e242ac92b345f440eaecfb72a7ebae"},
|
||||
{file = "python-gnupg-0.4.9.tar.gz", hash = "sha256:aaa748795572591aaf127b4ac8985684f3673ff82b39f370c836b006e68fc537"},
|
||||
{file = "python_gnupg-0.4.9-py2.py3-none-any.whl", hash = "sha256:012960bde4d25dad631bb7650f563dda5e7271248a73f3584240063a293d99d8"},
|
||||
]
|
||||
python-semantic-release = [
|
||||
{file = "python-semantic-release-7.29.4.tar.gz", hash = "sha256:2aef09899724ec3bf4ff90b5959cb447c4f2f3a6f386038ad0708d3045a5396d"},
|
||||
@@ -2666,8 +2689,8 @@ readme-renderer = [
|
||||
{file = "readme_renderer-35.0.tar.gz", hash = "sha256:a727999acfc222fc21d82a12ed48c957c4989785e5865807c65a487d21677497"},
|
||||
]
|
||||
requests = [
|
||||
{file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"},
|
||||
{file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"},
|
||||
{file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"},
|
||||
{file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"},
|
||||
]
|
||||
requests-toolbelt = [
|
||||
{file = "requests-toolbelt-0.9.1.tar.gz", hash = "sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "cic-cli"
|
||||
version = "0.5.0"
|
||||
version = "0.5.4"
|
||||
description = "Generic cli tooling for the CIC token network"
|
||||
authors = [
|
||||
"Louis Holbrook <dev@holbrook.no>",
|
||||
@@ -43,7 +43,7 @@ default = true
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
funga-eth = "^0.6.0"
|
||||
cic-types = "^0.2.2"
|
||||
cic-types = "^0.2.7"
|
||||
confini = "^0.6.0"
|
||||
chainlib = "~0.1.0"
|
||||
cbor2 = "~5.4.1"
|
||||
|
||||
Reference in New Issue
Block a user