aertje / cloud-tasks-emulator

Google cloud tasks emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python snippet incorrect

solsticedhiver opened this issue · comments

To get it working I had to use:

from google.cloud import tasks_v2
transport = None
project = 'myrealproject'
location = 'somelocation'
if DEBUG:
        import grpc
        channel = grpc.insecure_channel('localhost:8123')
        transport = tasks_v2.services.cloud_tasks.transports.CloudTasksGrpcTransport(channel=channel)
        project = 'dev'
        location = 'here'
client = tasks_v2.CloudTasksClient(transport=transport)

Hi @solsticedhiver, cheers for that. I had a look at the python client library; looks like they removed the channel argument from the client constructor in the 2.0.0 release on 3 Sep. Earlier versions will still work as per the code snippet.

I will update and note the version dependency.