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 5b2415f4
authored
May 15, 2018
by
Diego Lima
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aplicar descontos nos preços
1 parent
fa6bf9ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
gce_parser.py
gce_parser.py
View file @
5b2415f
...
@@ -29,10 +29,10 @@ GCE_REGIONS = [
...
@@ -29,10 +29,10 @@ GCE_REGIONS = [
]
]
GCE_OS
=
[
'linux'
,
'win'
,
'rhel'
,
'suse'
,
'suse-sap'
,
'sql-standard'
,
'sql-web'
,
'sql-enterprise'
]
GCE_OS
=
[
'linux'
,
'win'
,
'rhel'
,
'suse'
,
'suse-sap'
,
'sql-standard'
,
'sql-web'
,
'sql-enterprise'
]
#
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
[
'gcp_price_list'
]:
for
product
in
DATA
[
'gcp_price_list'
]:
if
'CUSTOM-VM-'
not
in
product
:
if
'CUSTOM-VM-'
not
in
product
:
if
PRODUCT_FAMILY
in
product
:
# Discard non-product entries
if
PRODUCT_FAMILY
in
product
:
# Discard non-product entries
...
@@ -52,7 +52,7 @@ with open(FCATALOG) as url:
...
@@ -52,7 +52,7 @@ with open(FCATALOG) as url:
for
region
in
GCE_REGIONS
:
for
region
in
GCE_REGIONS
:
cost
=
DATA
[
'gcp_price_list'
][
product
][
region
]
cost
=
DATA
[
'gcp_price_list'
][
product
][
region
]
if
PRODUCT_FAMILY
==
COMPUTE_PRODUCT_FAMILY
:
if
PRODUCT_FAMILY
==
COMPUTE_PRODUCT_FAMILY
:
cost
=
DATA
[
'gcp_price_list'
][
product
][
region
]
cost
=
cost
-
(
cost
*
0.3
)
if
float
(
cost
)
!=
0
:
if
float
(
cost
)
!=
0
:
for
os
in
GCE_OS
:
for
os
in
GCE_OS
:
if
os
==
'linux'
:
if
os
==
'linux'
:
...
...
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