kopia lustrzana https://github.com/sepandhaghighi/samila
Merge pull request #52 from sepandhaghighi/nft_storage_modification
nft_storage modificationpull/55/head
commit
1d90a9f416
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
- `README.md` updated
|
- `README.md` updated
|
||||||
- `__main__.py` updated
|
- `__main__.py` updated
|
||||||
- `test.yml` updated
|
- `test.yml` updated
|
||||||
|
- `nft_storage` method updated
|
||||||
## [0.1] - 2021-09-30
|
## [0.1] - 2021-09-30
|
||||||
### Added
|
### Added
|
||||||
- `GenerativeImage` class
|
- `GenerativeImage` class
|
||||||
|
|
|
@ -116,6 +116,8 @@ class GenerativeImage:
|
||||||
:type api_key: str
|
:type api_key: str
|
||||||
:return: result as dict
|
:return: result as dict
|
||||||
"""
|
"""
|
||||||
|
if self.fig is None:
|
||||||
|
return {"status": False, "message": NFT_STORAGE_FIG_ERROR_MESSAGE}
|
||||||
buf = io.BytesIO()
|
buf = io.BytesIO()
|
||||||
self.fig.savefig(buf, format='png')
|
self.fig.savefig(buf, format='png')
|
||||||
response = nft_storage_upload(api_key=api_key, data=buf.getvalue())
|
response = nft_storage_upload(api_key=api_key, data=buf.getvalue())
|
||||||
|
|
|
@ -24,7 +24,8 @@ DEFAULT_SPOT_SIZE = 0.01
|
||||||
DEFAULT_PROJECTION = None
|
DEFAULT_PROJECTION = None
|
||||||
VALID_COLORS = list(dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS).keys())
|
VALID_COLORS = list(dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS).keys())
|
||||||
NFT_STORAGE_API = "https://api.nft.storage/upload"
|
NFT_STORAGE_API = "https://api.nft.storage/upload"
|
||||||
NFT_STORAGE_SUCCESS_MESSAGE = "Everything seems good"
|
NFT_STORAGE_SUCCESS_MESSAGE = "Everything seems good."
|
||||||
|
NFT_STORAGE_FIG_ERROR_MESSAGE = "No figure was found. First run `generate` and `plot` methods."
|
||||||
|
|
||||||
|
|
||||||
class Projection(Enum):
|
class Projection(Enum):
|
||||||
|
|
|
@ -47,4 +47,10 @@ True
|
||||||
False
|
False
|
||||||
>>> result['message']
|
>>> result['message']
|
||||||
'API Key is missing, make sure the `Authorization` header has a value in the following format `Bearer {api key}`.'
|
'API Key is missing, make sure the `Authorization` header has a value in the following format `Bearer {api key}`.'
|
||||||
|
>>> g = GenerativeImage(f1,f2)
|
||||||
|
>>> result = g.nft_storage(api_key="")
|
||||||
|
>>> result["status"]
|
||||||
|
False
|
||||||
|
>>> result["message"]
|
||||||
|
'No figure was found. First run `generate` and `plot` methods.'
|
||||||
"""
|
"""
|
||||||
|
|
Ładowanie…
Reference in New Issue