Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Diego Lima
/
aws-price-parser
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e3487b4a
authored
Feb 20, 2018
by
Diego Lima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adicionar informacoes de compartilhamento de nucleos
1 parent
8999c2d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
aws_parser.py
aws_parser.py
View file @
e3487b4
...
@@ -47,10 +47,10 @@ elif PRODUCT_TYPE == 'database':
...
@@ -47,10 +47,10 @@ elif PRODUCT_TYPE == 'database':
CATALOG
=
'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/index.json'
CATALOG
=
'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonRDS/current/index.json'
PRODUCT_FAMILY
=
'Database Instance'
PRODUCT_FAMILY
=
'Database Instance'
with
urllib
.
request
.
urlopen
(
CATALOG
)
as
url
:
#
with urllib.request.urlopen(CATALOG) as url:
DATA
=
json
.
loads
(
url
.
read
()
.
decode
())
#
DATA = json.loads(url.read().decode())
#
with open(FCATALOG) as url:
with
open
(
FCATALOG
)
as
url
:
#
DATA = json.load(url)
DATA
=
json
.
load
(
url
)
for
product
in
DATA
[
"products"
]:
for
product
in
DATA
[
"products"
]:
if
DATA
[
'products'
][
product
]
.
get
(
'productFamily'
)
==
PRODUCT_FAMILY
:
if
DATA
[
'products'
][
product
]
.
get
(
'productFamily'
)
==
PRODUCT_FAMILY
:
sku
=
DATA
[
'products'
][
product
]
.
get
(
'sku'
)
sku
=
DATA
[
'products'
][
product
]
.
get
(
'sku'
)
...
@@ -64,8 +64,13 @@ with urllib.request.urlopen(CATALOG) as url:
...
@@ -64,8 +64,13 @@ with urllib.request.urlopen(CATALOG) as url:
memory
=
str
(
DATA
[
'products'
][
product
][
'attributes'
][
'memory'
])
.
replace
(
','
,
''
)
memory
=
str
(
DATA
[
'products'
][
product
][
'attributes'
][
'memory'
])
.
replace
(
','
,
''
)
if
PRODUCT_TYPE
==
'compute'
:
if
PRODUCT_TYPE
==
'compute'
:
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'operatingSystem'
]
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'operatingSystem'
]
family
=
str
(
name
[:
1
])
if
family
==
't'
:
sharedcores
=
'shared'
else
:
sharedcores
=
'nonshared'
if
DATA
[
'products'
][
product
][
'attributes'
][
'tenancy'
]
==
'Shared'
:
if
DATA
[
'products'
][
product
][
'attributes'
][
'tenancy'
]
==
'Shared'
:
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
o
s
))
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
sharedcore
s
))
elif
PRODUCT_TYPE
==
'database'
:
elif
PRODUCT_TYPE
==
'database'
:
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'databaseEngine'
]
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'databaseEngine'
]
edition
=
DATA
[
'products'
][
product
][
'attributes'
]
.
get
(
'databaseEdition'
)
edition
=
DATA
[
'products'
][
product
][
'attributes'
]
.
get
(
'databaseEdition'
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment