Opensea NFT MetadataAPI Python

2024-09-30 16:40:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我想为NFT元数据运行以下脚本

"https://github.com/ProjectOpenSea/metadata-api-python"

无论何时运行脚本,都会收到以下错误消息:

python3 app.py
 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 106-248-837
127.0.0.1 - - [10/Sep/2021 18:11:05] "GET / HTTP/1.1" 404 -
127.0.0.1 - - [10/Sep/2021 18:11:09] "GET / HTTP/1.1" 404 -
127.0.0.1 - - [10/Sep/2021 18:11:10] "GET /creature/2 HTTP/1.1" 404 -
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET / HTTP/1.1" 404 -
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET /api/creature/2 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 2088, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/Kehrenkamp/Desktop/opensea-creatures-master/metadata-api/app.py", line 112, in creature
    image_url = _compose_image(['images/bases/base-%s.png' % base,
  File "/Users/Kehrenkamp/Desktop/opensea-creatures-master/metadata-api/app.py", line 311, in _compose_image
    blob = _get_bucket().blob(f'{path}/{token_id}.png')
  File "/Users/Kehrenkamp/Desktop/opensea-creatures-master/metadata-api/app.py", line 327, in _get_bucket
    return client.get_bucket(GOOGLE_STORAGE_BUCKET)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/google/cloud/storage/client.py", line 762, in get_bucket
    bucket = self._bucket_arg_to_bucket(bucket_or_name)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/google/cloud/storage/client.py", line 241, in _bucket_arg_to_bucket
    bucket = Bucket(self, name=bucket_or_name)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/google/cloud/storage/bucket.py", line 611, in __init__
    name = _validate_name(name)
  File "/Users/Kehrenkamp/Library/Python/3.8/lib/python/site-packages/google/cloud/storage/_helpers.py", line 81, in _validate_name
    raise ValueError("Bucket names must start and end with a number or letter.")
ValueError: Bucket names must start and end with a number or letter.
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET /api/creature/2?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET /api/creature/2?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET /api/creature/2?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
127.0.0.1 - - [10/Sep/2021 18:11:11] "GET /api/creature/2?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -

我的问题是如何正确配置我的Google存储帐户,使其正常工作

每次我用:ValueError(Bucket名称必须以数字或字母开头和结尾)再次出现错误时

我的桶名是:“kehrenkamp”他以字母开头,以字母结尾

有人能帮我吗

提前谢谢

问候凯伦坎普


Tags: inpyapiappgetbucketlibpackages