Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何通过boto3获得AWS的配额?_Python_Python 3.x_Amazon Web Services_Boto3 - Fatal编程技术网

Python 如何通过boto3获得AWS的配额?

Python 如何通过boto3获得AWS的配额?,python,python-3.x,amazon-web-services,boto3,Python,Python 3.x,Amazon Web Services,Boto3,我正在为AWS开发boto3-SDK python 我从ec2的简单服务配额开始,但最后总是出现以下错误 import boto3 quota_client = boto3.client('service-quotas') response = quota_client.get_service_quota( ServiceCode='ec2' ) 错误: botocore.exceptions.UnknownServiceError: Unknown service: 'service-

我正在为AWS开发boto3-SDK python

我从ec2的简单服务配额开始,但最后总是出现以下错误

import boto3

quota_client = boto3.client('service-quotas')
response = quota_client.get_service_quota(
ServiceCode='ec2'
)
错误:

botocore.exceptions.UnknownServiceError: Unknown service: 'service- 
quotas'. Valid service names are: acm, acm-pca, alexaforbusiness, 
amplify, apigateway, apigatewaymanagementapi, apigatewayv2, 
application-autoscaling, appmesh, appstream, appsync, athena, 
autoscaling, autoscaling-plans, backup, batch, budgets, ce, chime, 
cloud9, clouddirectory, cloudformation, cloudfront, cloudhsm, 
cloudhsmv2, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, 
codebuild, codecommit, codedeploy, codepipeline, codestar, cognito- 
identity, cognito-idp, cognito-sync, comprehend, comprehendmedical, 
config, connect, cur, datapipeline, datasync, dax, devicefarm, 
directconnect, discovery, dlm, dms, docdb, ds, dynamodb, 
dynamodbstreams, ec2, ecr, ecs, efs, eks, elasticache, 
elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, 
firehose, fms, fsx, gamelift, glacier, globalaccelerator, glue, 
greengrass, groundstation, guardduty, health, iam, importexport, 
inspector, iot, iot-data, iot-jobs-data, iot1click-devices, iot1click- 
projects, iotanalytics, iotevents, iotevents-data, iotthingsgraph, 
kafka, kinesis, kinesis-video-archived-media, kinesis-video-media, 
 kinesisanalytics, kinesisanalyticsv2, kinesisvideo, kms, lambda, lex- 
models, lex-runtime, license-manager, lightsail, logs, 
 machinelearning, macie, managedblockchain, marketplace-entitlement, 
 marketplacecommerceanalytics, mediaconnect, mediaconvert, medialive, 
 mediapackage, mediapackage-vod, mediastore, mediastore-data, 
mediatailor, meteringmarketplace, mgh, mobile, mq, mturk, neptune, 
 opsworks, opsworkscm, organizations, personalize, personalize-events, 
 personalize-runtime, pi, pinpoint, pinpoint-email, pinpoint-sms-voice, polly, pricing, 
 quicksight, ram, rds, rds-data, redshift, rekognition, resource-groups, 
 resourcegroupstaggingapi, robomaker, route53, route53domains, 
 route53resolver, s3, s3control, sagemaker, sagemaker-runtime, sdb, 
secretsmanager, securityhub, serverlessrepo, servicecatalog, 
servicediscovery, ses, shield, signer, sms, sms-voice, snowball, sns, sqs, 
ssm, stepfunctions, storagegateway, sts, support, swf, textract, 
transcribe, transfer, translate, waf, waf-regional, workdocs, worklink, 
workmail, workspaces, xray
文档页面显示boto3支持服务配额,但看起来不是,或者我在这里做了什么不正确的事情


我可以用当前的
boto3-1.9.174 botocore-1.12.174安装重现问题

然后我做了:

pip install boto3 --upgrade
它将我移动到版本
boto3-1.9.208 botocore-1.12.208
,并且工作正常


我尝试使用Python虚拟环境隔离库,以便于更新。

这对我很有用。您是否尝试过更新您的
bot3
模块?是的,我已更新模块,当前版本为1.9.207。这是正确的版本吗?我的版本是1.9.190。很可能这些版本在某个地方发生了冲突。你也可以尝试降级。谢谢约翰,尝试了同样的方法,现在效果很好