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 97d0cd51
authored
Apr 06, 2018
by
diegolima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mostrar SKUs
1 parent
cbb17bec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
aws_parser.py
aws_parser.py
View file @
97d0cd5
...
...
@@ -39,10 +39,10 @@ else:
print
(
"Product type not supported"
)
sys
.
exit
(
1
)
with
urllib
.
request
.
urlopen
(
CATALOG
)
as
url
:
DATA
=
json
.
loads
(
url
.
read
()
.
decode
())
#
with open(FCATALOG) as url:
#
DATA = json.load(url)
#
with urllib.request.urlopen(CATALOG) as url:
#
DATA = json.loads(url.read().decode())
with
open
(
FCATALOG
)
as
url
:
DATA
=
json
.
load
(
url
)
for
product
in
DATA
[
"products"
]:
if
DATA
[
'products'
][
product
]
.
get
(
'productFamily'
)
==
PRODUCT_FAMILY
:
sku
=
DATA
[
'products'
][
product
]
.
get
(
'sku'
)
...
...
@@ -62,10 +62,10 @@ with urllib.request.urlopen(CATALOG) as url:
else
:
sharedcores
=
'nonshared'
if
DATA
[
'products'
][
product
][
'attributes'
][
'tenancy'
]
==
'Shared'
:
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
sharedcores
))
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
sharedcores
,
sku
))
elif
PRODUCT_TYPE
==
'database'
:
os
=
DATA
[
'products'
][
product
][
'attributes'
][
'databaseEngine'
]
edition
=
DATA
[
'products'
][
product
][
'attributes'
]
.
get
(
'databaseEdition'
)
licensemodel
=
DATA
[
'products'
][
product
][
'attributes'
][
'licenseModel'
]
deployment
=
DATA
[
'products'
][
product
][
'attributes'
][
'deploymentOption'
]
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
edition
,
licensemodel
,
deployment
))
print
(
'aws,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s
,
%
s'
%
(
name
,
cpu
,
memory
,
cost
,
region
,
os
,
edition
,
licensemodel
,
deployment
,
sku
))
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