eve-val/evelink

corp killmails - requests.exceptions.ConnectionError

regner opened this issue · 2 comments

Getting an error when not using a cache:

import pprint
import evelink.api
import evelink.corp
import logging


api = evelink.api.API(api_key=('11111', 'aaaaaaa'))

logging.basicConfig(level=logging.DEBUG)

corp = evelink.corp.Corp(api=api)
killmails= corp.kills()

pprint.pprint(killmails)

Running it once works fine, running it a second time shortely after generates the following error:

(venv)regner@HGPC01:~/git/stevetest$ python test.py 
DEBUG:evelink.api:Calling corp/KillLog with params={}
DEBUG:evelink.api:keyID and vCode added
DEBUG:evelink.api:POSTing request
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.eveonline.com
Traceback (most recent call last):
  File "test.py", line 12, in <module>
    killmails= corp.kills()
  File "/home/regner/.local/lib/python2.7/site-packages/evelink/api.py", line 510, in wrapper
    kw['api_result'] = client.api.get(self.path, params=params)
  File "/home/regner/.local/lib/python2.7/site-packages/evelink/api.py", line 265, in get
    response, robj = self.send_request(full_path, params)
  File "/home/regner/.local/lib/python2.7/site-packages/evelink/api.py", line 315, in send_request
    return self.requests_request(full_path, params)
  File "/home/regner/.local/lib/python2.7/site-packages/evelink/api.py", line 372, in requests_request
    raise e
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('HTTP/1.1 000 \r\n',))

After talking to some people on Slack it seems there are two endpoints for kills:

  • corp/KillLog
  • corp/KillMails

evelink is using corp/KillLog (https://github.com/eve-val/evelink/blob/master/evelink/corp.py#L139).

KillLog is apparently the older version that only works for one request per cache time. Hitting it again before the cache expires generates an error. corp/KillMails is better apparently.

As the person who maintains the API I want to point out this was written a long time before me and I have not had any reason to look into why it is this way. So please don't hurt me. >.<

Shit, guess this is a duplicate of #210, posted just a few minutes apart. Sorry!