Request prices for EC2

        Return a list of possible prices for EC2

        This method gives output: ``v1/prices.json#``

        This method is ``experimental``
972281
def getPrices(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["getPrices"], *args, **kwargs)
723590
def prices(self):
        
        if self.root.stale:
            self.root.update(self.now, None)
        return self._prices.loc[:self.now]
501553
def get_card_prices(ctx, currency):
    
    appid = ctx.obj['appid']

    detailed = True

    appids = [appid]
    if ',' in appid:
        appids = [appid.strip() for appid in appid.split(',')]
        detailed = False

    for appid in appids:
        print_card_prices(appid, currency, detailed=detailed)
        click.echo('')
1168917
def get_buy_price(self, **params):
        """"""
        currency_pair = params.get('currency_pair', 'BTC-USD')
        response = self._get('v2', 'prices', currency_pair, 'buy', params=params)
        return self._make_api_object(response, APIObject)
301738
async def get_offers(self, **params):
		
		if params.get("message"):
			params = json.loads(params.get("message", "{}"))
		
		if not params:
			return {"error":400, "reason":"Missed required fields"}

		cid = params.get("cid")
		public_key = params.get("public_key")
		coinid = params.get("coinid")


		# Get all input offers by cid
		if cid and coinid:
			cid = int(cid)
			database = client[coinid]
			offer_collection = database[settings.OFFER]
			content_collection = database[settings.CONTENT]

			offers = [{i:document[i] for i in document if i == "confirmed"} 
						async for document in offer_collection.find({"cid":cid, "confirmed":None})]

		# Get all output users offers
		elif not cid:
			database = client[coinid]
			offer_collection = database[settings.OFFER]
			offers = [{i:document[i] for i in document if i == "confirmed"} 
						async for document in offer_collection.find({"public_key":public_key, 
																	"confirmed":None})]

		# Return list with offers
		return offers
988890
def get_price(self, **kwargs):
        
        def fmt_p(out):
            return pd.DataFrame(out, index=self.symbols)

        return self._get_endpoint("price", fmt_p=fmt_p, params=kwargs)
906184
def get_grid_prices_by_date(self, **params):
        
        service_url = "{url}/{params_path}".format(
            url=self.BROWSE_GRID_SERVICE_URL,
            params_path=self._construct_params(
                params, self._REQ_PARAMS, self._OPT_PARAMS)
        )
        return self.make_request(
            service_url,
            headers=self._headers(),
            **params
        )
51347
def GET_prices_namespace( self, path_info, namespace_id ):
        
        if not check_namespace(namespace_id):
            return self._reply_json({'error': 'Invalid namespace'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        price_info = blockstackd_client.get_namespace_cost(namespace_id, hostport=blockstackd_url)
        if json_is_error(price_info):
            # error
            status_code = price_info.get('http_status', 502)
            return self._reply_json({'error': price_info['error']}, status_code=status_code)

        ret = {
            'amount': str(price_info['amount']),        # helps JS clients that can't parse big ints
            'units': price_info['units'],
        }

        if ret['units'] == 'BTC':
            # v1 compat
            ret['satoshis'] = price_info['amount']

        return self._reply_json(ret)
394084
def get_billable_items(self):
        
        items = []
        for obj in self.context.getBillableItems():
            if self.is_profile(obj):
                items.append({
                    "obj": obj,
                    "title": obj.Title(),
                    "vat": obj.getAnalysisProfileVAT(),
                    "price": self.format_price(obj.getAnalysisProfilePrice()),
                })
            if self.is_analysis(obj):
                items.append({
                    "obj": obj,
                    "title": obj.Title(),
                    "vat": obj.getVAT(),
                    "price": self.format_price(obj.getPrice()),
                })
        return items
192619
def json(self):
        
        nodes = []
        links = []

        for link in self.link_set.all():
            if self.is_layer2:
                source = link.interface_a.mac
                destination = link.interface_b.mac
            else:
                source = str(link.interface_a.ip_set.first().address)
                destination = str(link.interface_b.ip_set.first().address)
            nodes.append({
                'id': source
            })
            nodes.append({
                'id': destination
            })
            links.append(OrderedDict((
                ('source', source),
                ('target', destination),
                ('cost', link.metric_value)
            )))

        return OrderedDict((
            ('type', 'NetworkGraph'),
            ('protocol', self.parser.protocol),
            ('version', self.parser.version),
            ('metric', self.parser.metric),
            ('nodes', nodes),
            ('links', links)
        ))
785222
def _get_upgrade_prices(self, instance_id, include_downgrade_options=True):
        
        mask = [
            'id',
            'locationGroupId',
            'categories[name,id,categoryCode]',
            'item[description,capacity,units]'
        ]
        mask = "mask[%s]" % ','.join(mask)
        return self.guest.getUpgradeItemPrices(include_downgrade_options, id=instance_id, mask=mask)
642402
def get(self, **params):
        '''
        
        '''
        return self.client.get('/v2/shopping/hotel-offers/{0}'
                               .format(self.offer_id), **params)
784708
def query_instances(session, client=None, **query):
    
    if client is None:
        client = session.client('ec2')
    p = client.get_paginator('describe_instances')
    results = p.paginate(**query)
    return list(itertools.chain(
        *[r["Instances"] for r in itertools.chain(
            *[pp['Reservations'] for pp in results])]))
119330
def update_pricing(kwargs=None, call=None):
    '''
    
    '''
    url = 'https://cloudpricingcalculator.appspot.com/static/data/pricelist.json'
    price_json = salt.utils.http.query(url, decode=True, decode_type='json')

    outfile = os.path.join(
        __opts__['cachedir'], 'gce-pricing.p'
    )
    with salt.utils.files.fopen(outfile, 'w') as fho:
        salt.utils.msgpack.dump(price_json['dict'], fho)

    return True
434744
def json(self, **kwargs):
        
        try:
            return super(ScraperResponse, self).json(**kwargs)
        except ValueError as ve:
            raise ParseException(ve)
811268
def get_last_available_price(self) -> PriceModel:
        
        price_db = PriceDbApplication()
        symbol = SecuritySymbol(self.security.namespace, self.security.mnemonic)
        result = price_db.get_latest_price(symbol)
        return result
132138
def create_session(self, **params):
        

        required_keys = ('market', 'currency', 'locale', 'pickupplace',
                         'dropoffplace', 'pickupdatetime', 'dropoffdatetime',
                         'driverage')

        service_url = "{url}/{params_path}".format(
            url=self.PRICING_SESSION_URL,
            params_path=self._construct_params(params, required_keys)
        )

        poll_path = self.make_request(service_url,
                                      headers=self._session_headers(),
                                      callback=lambda resp: resp.headers[
                                          'location'],
                                      userip=params['userip'])

        return "{url}{path}".format(url=self.API_HOST, path=poll_path)