4 Commits

Author SHA1 Message Date
semantic-release
7b7fd1e2bb 0.5.3
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-07-05 08:14:20 +00:00
4eda0fb5cc fix: add auth headers to HTTPWriter
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 11:12:54 +03:00
semantic-release
fa43080602 0.5.2
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-07-05 07:47:54 +00:00
15ae1143a5 fix: bump cic-types
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 10:46:29 +03:00
7 changed files with 24 additions and 14 deletions

View File

@@ -2,6 +2,14 @@
<!--next-version-placeholder-->
## 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))

View File

@@ -1 +1 @@
__version__ = "0.5.1"
__version__ = "0.5.3"

View File

@@ -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)

View File

@@ -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,

View File

@@ -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)
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()}")

4
poetry.lock generated
View File

@@ -286,7 +286,7 @@ reference = "grassroots_"
[[package]]
name = "cic-types"
version = "0.2.6"
version = "0.2.7"
description = "Defines descriptors for data objects specific to the CIC-Network."
category = "main"
optional = false
@@ -2046,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 = "e068d23fc73a61c8cbc0da5d863bf839f6a8610c61a220ac33b12ea46c8b202a"
content-hash = "1379242725006a2a94a6c7cf2a6924a1a117803b6898f0bcea88c9ff760a7e87"
[metadata.files]
asn1crypto = [

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "cic-cli"
version = "0.5.1"
version = "0.5.3"
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.6"
cic-types = "^0.2.7"
confini = "^0.6.0"
chainlib = "~0.1.0"
cbor2 = "~5.4.1"