Can anyone help me with how to resolve the above issues?

On Thursday, March 18, 2021 at 7:17:18 PM UTC+5:30 ASHIK RANJAN wrote:

> I am using the flask application on the google app engine flexible 
> environment.
>
> 1. I want to create a task whenever some URL has been hit by a user and 
> queues should hit the google app engine endpoint for executing the task. 
> For example, I am appending the code here
> The same code is working fine and creating a task if executed from another 
> server
>
> import json
> import datetime
> from google.cloud import tasks_v2beta3
> from google.protobuf import timestamp_pb2
>
> import json
> import datetime
> from google.cloud import tasks_v2beta3
> from google.protobuf import timestamp_pb2
>
>
> class CloudTaskManager:
>     def __init__(self):
>         self.client = tasks_v2beta3.CloudTasksClient()
>
>     def create_task(self, project, queue, location, payload=None, 
> in_seconds=5):
>         parent = self.client.queue_path(project, location, queue)
>
>         task = {
>             'app_engine_http_request': {
>                 'http_method': tasks_v2beta3.HttpMethod.POST 
> <http://tasks_v2beta3.httpmethod.post/>,
>                 'relative_uri': '/api/v1/rating/cloud_task_handler',
>                 'headers': {
>                     'Content-Type': 'application/json',
>                     'Org_Name': 'organization1'
>                 },
>                 'body': json.dumps(payload).encode()
>             }
>         }
>
>         if in_seconds is not None:
>             d = datetime.datetime.utcnow() + 
> datetime.timedelta(seconds=in_seconds)
>             timestamp = timestamp_pb2.Timestamp()
>             timestamp.FromDatetime(d)
>             task['schedule_time'] = timestamp
>
>         response = self.client.create_task(parent=parent, task=task)
>         return response
>
> 2. Another case is that I want to use cloud firestore API that is in 
> native mode and the code snippet are as below.
>    cred = credentials.Certificate('name.json')  
>     # cred = credentials.ApplicationDefault()
>     if not firebase_admin._apps:
>         firebase_admin.initialize_app(cred, {
>           'projectId': 'project-id',
>         })
>     db = firestore.client()
>     collection_refs = db.collection('collection-name')
>     documents = collection_refs.stream()
>     for doc in documents:
>         return doc.to_dict()
>
> On Wed, Mar 17, 2021 at 8:34 PM 'Elliott (Cloud Platform Support)' via 
> Google App Engine <google-a...@googlegroups.com> wrote:
>
>>
>> Hello,
>>
>> I understand that you want to use the Cloud Tasks API to create a task 
>> and push in a queue from the app engine flexible environment but it doesn't 
>> work. Also you are not able to use the Firestore API in native mode.
>>
>> You’ve also mentioned that an API is working fine from outside of google 
>> cloud using the same service account credentials.
>>
>> In addition, you asked for some help with settings.
>>
>> To determine a common issue, can you please tell me more about your code 
>> and where you get stuck? Are there error messages? Google Groups is meant 
>> for general discussions about Google products and if a scenario is 
>> determined to be a common issue, an Issue Tracker may be created. Right 
>> now, I do not have enough information to decide the next steps.
>>
>> Would you provide this information for the benefit of the community and 
>> if it is common, others the groups may be able to recognize it.
>>
>> I hope that after getting your details, some advice will be offered.
>>
>> I will wait for your response.
>>
>> On Wednesday, March 17, 2021 at 9:43:01 AM UTC-4 ashikr...@gmail.com 
>> wrote:
>>
>>> I want to use cloud task api to create task and push in the queue from 
>>> the app engine flexible environment but it doesn't work and also not able 
>>> to use firestore api in native mode.
>>>
>>> Same API is working fine from the server outside of google cloud using 
>>> the same service account credentials.
>>>
>>> Can you please help if we can use both the api from the app engine or I 
>>> need to make some changes in the settings.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-appengi...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-appengine/73e344f4-862e-465d-a1e6-857219e4fd28n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-appengine/73e344f4-862e-465d-a1e6-857219e4fd28n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/9c59815f-040c-46ba-8cd3-28204502a4d2n%40googlegroups.com.

Reply via email to