Merge pull request #52 from sepandhaghighi/nft_storage_modification

nft_storage modification
pull/55/head
Sadra Sabouri 2021-10-12 12:39:06 +03:30 zatwierdzone przez GitHub
commit 1d90a9f416
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `README.md` updated
- `__main__.py` updated
- `test.yml` updated
- `nft_storage` method updated
## [0.1] - 2021-09-30
### Added
- `GenerativeImage` class

Wyświetl plik

@ -116,6 +116,8 @@ class GenerativeImage:
:type api_key: str
:return: result as dict
"""
if self.fig is None:
return {"status": False, "message": NFT_STORAGE_FIG_ERROR_MESSAGE}
buf = io.BytesIO()
self.fig.savefig(buf, format='png')
response = nft_storage_upload(api_key=api_key, data=buf.getvalue())

Wyświetl plik

@ -24,7 +24,8 @@ DEFAULT_SPOT_SIZE = 0.01
DEFAULT_PROJECTION = None
VALID_COLORS = list(dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS).keys())
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):

Wyświetl plik

@ -47,4 +47,10 @@ True
False
>>> result['message']
'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.'
"""