Example #1
0
    def contact_corp(self, corp_url):
        try:
            my_corp = Corporation.objects.mine()
            url = urlparse.urljoin(corp_url, '/corp/contact/')

            client = HttpClient()
            LOG.info('Sending our public info to %s...' % url)
            # first GET request to fetch CSRF cookie
            response = client.get(url)
            # second POST request to send our public info
            response = client.post(url, json.dumps(my_corp.get_public_info()))

            LOG.info('Fetching public info from %s...' % url)
            # the response should contain the corp's public info
            public_info = json.load(response)
            self.corporationID = public_info['corporationID']
            self.corporationName = public_info['corporationName']
            self.ticker = public_info['ticker']
            self.alliance_id = public_info['alliance']
            self.public_key = public_info['public_key']
            self.key_fingerprint = public_info['key_fingerprint']
            self.is_my_corp = False
            self.is_trusted = True

            LOG.info('Corp %s accepted our contact request.' %
                     self.corporationName)
            LOG.info('Wait until they confirm that they trust us '
                     'before you can exchange data with them.')
        except urllib2.HTTPError, e:
            message = 'URL: %s, Response: %s %s "%s"' % (e.url, e.code,
                                                         e.reason, e.read())
            LOG.exception(message)
            raise ValidationError(message)
Example #2
0
def get_buy_prices(item_ids, systemID):
    "http://www.evemarketeer.com/api/info/34/json/10000043/buy_highest5"
    prices = {}
    for item in item_ids:

        if systemID == 1:
            systemID = 10000002

        evemarketeerurl = "http://www.evemarketeer.com/api/info/"
        url = evemarketeerurl + str(item) + "/json/" + str(systemID) + "/buy_highest5"
        # logger.debug('Fetching market info from %s...' % url)
        response = urllib2.urlopen(url)
        price = json.load(response)
        prices[item] = price[0]["buy_highest5"]
    return prices
Example #3
0
def get_buy_prices(item_ids, systemID):
    'http://www.evemarketeer.com/api/info/34/json/10000043/buy_highest5'
    prices = {}
    for item in item_ids:

        if systemID == 1:
            systemID = 10000002

        evemarketeerurl = 'http://www.evemarketeer.com/api/info/'
        url = evemarketeerurl + str(item) + '/json/' + str(
            systemID) + '/buy_highest5'
        #logger.debug('Fetching market info from %s...' % url)
        response = urllib2.urlopen(url)
        price = json.load(response)
        prices[item] = price[0]['buy_highest5']
    return prices