Trying to read and write data using gspread; ended with APIErrors: Quota exceeded for quota metric - gspread

gspread.exceptions.APIError: {'code': 429, 'message': "Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute per user' of service 'sheets.googleapis.com' for consumer 'project_number:81537768804'.", 'status': 'RESOURCE_EXHAUSTED', 'details': [{'#type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'RATE_LIMIT_EXCEEDED', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/81537768804', 'quota_metric': 'sheets.googleapis.com/read_requests', 'quota_limit': 'ReadRequestsPerMinutePerUser', 'service': 'sheets.googleapis.com'}}]}

Related

IAM Cannot Access Launch Template

I am using the AWS Node SDK to try and use a launch template to launch an EC2 instance. In the web console for the same user I have access to the Launch Template ID, but in the Node API it tells me the Launch Template with ID does not exist:
version: aws-sdk#2.606.0
Screenshot in AWS Console
Screenshot in my config file
(I've blocked the last few characters for security but they are the same)
This is the Node
AWS = require('aws-sdk');
AWS.config.update({region: global.settings.aws.region});
let instanceParams = {
LaunchTemplate: {
LaunchTemplateId: global.settings.aws.ltId
},
InstanceType: 't2.micro',
MinCount: 1,
MaxCount: 1
};
let instancePromise = new AWS.EC2().runInstances(instanceParams).promise();
instancePromise.then(
function(data) {
console.log(data);
}).catch(
function(err) {
console.error(err, err.stack);
});
This is the error the API returns:
InvalidLaunchTemplateId.NotFound: The specified launch template, with template ID lt-03969d13638b5XXXX, does not exist.
at Request.extractError (/ApplicationPath/node_modules/aws-sdk/lib/services/ec2.js:50:35)
at Request.callListeners (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/ApplicationPath/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/ApplicationPath/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/ApplicationPath/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /ApplicationPath/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/ApplicationPath/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/ApplicationPath/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/ApplicationPath/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/ApplicationPath/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/ApplicationPath/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /ApplicationPath/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/ApplicationPath/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/ApplicationPath/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at callNextListener (/ApplicationPath/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at IncomingMessage.onEnd (/ApplicationPath/node_modules/aws-sdk/lib/event_listeners.js:307:13)
at IncomingMessage.emit (events.js:214:15)
at IncomingMessage.EventEmitter.emit (domain.js:476:20) {
message: 'The specified launch template, with template ID lt-03969d13638b5XXXX, does not exist.',
code: 'InvalidLaunchTemplateId.NotFound',
time: 2020-01-22T15:29:18.641Z,
requestId: '16082702-49c0-4451-a3b7-570b930b5238',
statusCode: 400,
retryable: false,
retryDelay: 47.92654090836894
}
The IAM access includes both:
AmazonEC2FullAccess
AmazonEC2FullAccess
(The JSON are super long but I am happy to post those in here if needed)
My thought is that there is some permissioning error for the IAM but I can't determine what that might be. Thank you for the help and please let me know if there is any other clarity I can provide.
When you can see that a given AWS resource exists in the AWS console, but it is not returned by the awscli or SDK calls, (or vice-versa) then one of the following is likely the cause:
you have queried the wrong region
you have queried the wrong AWS account (your effective credentials are for a 2nd, different account)
you have mis-typed the resource name/id
your browser has cached results that no longer exist (refresh your browser)

From where do I find the dialogflow request payload?

I have a flask based service hosted in Heroku. The endpoint of which is given as a fulfillment in dialogflow. Now I cannot figure out how to capture the request payload which dialogflow triggers everytime I request something.
I tried capturing and logging the same in heroku itself but that does not seem to be working.
The service code is as follows:
#app.route('/date/currentdate/<date>', methods = ['POST'])
def postJsonHandler():
print (request.is_json)
content = request.get_json()
logging.warning(content)
return 'JSON posted'
The json which i am getting is:
WARNING:root:{'responseId': 'c5115583-e9c5-497a-8a50-1ea07ab02dba-baaf0c1f', 'queryResult': {'queryText': 'send me the asap for 4568999', 'parameters': {'Dashboard': 'ASAP', 'number': 4568999.0}, 'allRequiredParamsPresent': True, 'fulfillmentMessages': [{'text': {'text': ['Hi I can definitely help you out with that.']}, 'platform': 'SKYPE'}, {'text': {'text': ['']}}], 'intent': {'name': 'replaced this', 'displayName': 'ASAP Dashboard'}, 'intentDetectionConfidence': 0.7012109, 'languageCode': 'en'}, 'originalDetectIntentRequest': {'payload': {}}, 'session': 'replaced this'}
There is diagnostic info section in the agent section which has got all the info related to request and response, it is sometimes not visible if there is pop up on the top of page, in my case it was the v2 getting outdated banner; on closing it the diagnostic info became visible.

google drive api client(python) update error

not working only update function.
https://developers.google.com/apis-explorer
and good work same parameter on api explorer.
update file is from cloud domain file. is that reason?
Traceback (most recent call last):
File "E:/cygwin64/home/socia/workspace/language/python/wc_py2_rule/src/main/python/package_name/module/sotrage/google_folder_changer.py", line 230, in <module>
main(sys.argv[1:])
File "E:/cygwin64/home/socia/workspace/language/python/wc_py2_rule/src/main/python/package_name/module/sotrage/google_folder_changer.py", line 101, in main
set_seed_file_on_folder(file_info, folder, service)
File "E:/cygwin64/home/socia/workspace/language/python/wc_py2_rule/src/main/python/package_name/module/sotrage/google_folder_changer.py", line 142, in set_seed_file_on_folder
removeParents=file_info['parents']).execute()
File "E:\cygwin64\home\socia\workspace\language\python\wc_py2_rule\venv\lib\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "E:\cygwin64\home\socia\workspace\language\python\wc_py2_rule\venv\lib\site-packages\googleapiclient\http.py", line 851, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/drive/v3/files/... returned "File not found: [u'file_id'].">
file_id is replaced on error cause of security
and link content is below.
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
"Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
Means that you are making a call to a private method without authenticating as a user first. If you want to see user data you must be authenticated as a user who has access to that data. Check your code and make sure that you have your authentication setup correctly and the user has logged in before you try and run the method in question.

how to update 'people/me'

i use
people.get({resourceName: 'people/me'})
get logged-in user's info, but i can't use
people.updateContact({resourceName: 'people/me', ...})
or
people.updateContact({resourceName: 'people/[meid]', ...})
update this info.
error message is :
{code: 400, message: "Resource name "people/me" is not a valid contact person resource.", status: "INVALID_ARGUMENT"}
or
{code: 400, message: "Resource name "people/[meid]" is not a valid contact person resource.", status: "INVALID_ARGUMENT"}
There isn't support for updating the people/me resource in the Google People API as the API only supports updating contacts, and people/me represents the person based on your profile / account. There's some info describing how merged people are composed at https://developers.google.com/people/#understanding_merged_person_data. Only contact based people can be updated.
I think you need to use the name which you get by your first line.
e.g.
people.updateContact({resourceName: 'Name which you got in response', ...})

Youtube playlistItems list API sometimes works, sometimes throws 404

I have retrieved upload Id from a channel as shown here(https://www.youtube.com/watch?v=RjUlmco7v2M&t=2s),
and using it as playlitstId here https://developers.google.com/youtube/v3/docs/playlistItems/list#try-it
Sometimes it gives 200, sometimes 404,
Response {_body: "{↵ "error": {↵ "errors": [↵ {↵ "domain":
"yo…003c/code\u003e parameter cannot be found."↵ }↵}↵", status: 404,
ok: false, statusText: "OK", headers: Headers…}
Additional info:
I have selected part as contentDetails,id,snippet
maxResults 50
You may check in this documentation the possible reasons why you got a 404 error in PlaylistItems: list. These methods could also return errors listed in the Common errors section.
notFound (404)
playlistNotFound
The playlist identified with the request's playlistId parameter cannot be found.
notFound (404)
videoNotFound
The video identified with the request's videoId parameter cannot be found.
required (400)
playlistIdRequired
The subscribe request does not specify a value for the required playlistId property.
However, if it doesn't solve your issue and you think that it is a bug, you can file a report here.

Resources