Я получаю HttpError при запуске моего кода с python3, но не при работе с python2.Код взят из this repo.
Ошибка возникает при записи логов со следующей трассировкой стека:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/me/project/gce/cloud_handler.py", line 163, in write_log
.execute(http=http)
File "/home/me/.local/lib/python3.5/site-
packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/me/.local/lib/python3.5/site-
packages/googleapiclient/http.py", line 851, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting
https://logging.googleapis.com/v1beta3/projects/b%27myprojectid%27/logs/task_runner/entries:write?alt=json
returned "field [name] has issue [Invalid project resource name]">
Есть идеи, как решить эту проблему?
def write_log(self, record):
{...}
try:
print(type(self.client))
resp = self.client.projects().logs().entries().write(
projectsId=self.project_id,
logsId=self.logname,
body=body)\
.execute(http=http) #ERROR HAPPENS HERE
except Exception as e:
sys.stderr.write(e.message + '\n')