Git Product home page Git Product logo

eveapi's Introduction

eveapi's People

Contributors

a-tal avatar evrial avatar lizthegrey avatar ntt avatar zweizeichen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eveapi's Issues

Certain keys should probably never be converted to int/float/date

PL's -10.0 ticker is interpreted as a float. I'm not aware of any others that actually cause a problem, but especially with floats there is always the chance it will be represented as something like -10.0000000000000001 and then not cast back to a string properly. If one is accidently interpreted as a date (which has special handling code) that might be a problem too.

eveapi starbase detail not pulling correctly. part 2

from version 1.2.3

cs.onStatusDrop.standing
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Element' object has no attribute 'standing'
from version 1.1.9
cs.onStatusDrop.standing
0

this follows on from the previous issue. is it possible that if it gets an api response with 0 as the result it takes it a null value and doesn't write the string?

Messed columns in api.eve.CharacterAffiliation()

Looks like eveapi lib take columns by position, not by xml attribute name:

>>> for i in api.eve.CharacterAffiliation(ids='735566805,91989271,233838523,1427330454').characters:
...   print i
...
Row(characterName:735566805,characterID:brammator,corporationName:98104433,corporationID:SUB ZERO.,allianceName:1411711376,allianceID:Legion of xXDEATHXx,factionName:0,factionID:)
Row(characterName:91989271,characterID:Y U NO,corporationName:98104433,corporationID:SUB ZERO.,allianceName:1411711376,allianceID:Legion of xXDEATHXx,factionName:0,factionID:)
Row(characterName:233838523,characterID:Karer II,corporationName:1139652088,corporationID:Legion of xXDEATHXx Support,allianceName:1411711376,allianceID:Legion of xXDEATHXx,factionName:0,factionID:)
Row(characterName:1427330454,characterID:Taemine,corporationName:98104433,corporationID:SUB ZERO.,allianceName:1411711376,allianceID:Legion of xXDEATHXx,factionName:0,factionID:)

Actual XML:

<?xml version='1.0' encoding='UTF-8'?>
<eveapi version="2">
  <currentTime>2014-07-25 20:11:49</currentTime>
  <result>
    <rowset name="characters" key="characterID" columns="characterName,characterID,corporationName,corporationID,allianceName,allianceID,factionName,factionID">
      <row characterID="735566805" characterName="brammator" corporationID="98104433" corporationName="SUB ZERO." allianceID="1411711376" allianceName="Legion of xXDEATHXx" factionID="0" factionName="" />
      <row characterID="91989271" characterName="Y U NO" corporationID="98104433" corporationName="SUB ZERO." allianceID="1411711376" allianceName="Legion of xXDEATHXx" factionID="0" factionName="" />
      <row characterID="233838523" characterName="Karer II" corporationID="1139652088" corporationName="Legion of xXDEATHXx Support" allianceID="1411711376" allianceName="Legion of xXDEATHXx" factionID="0" factionName="" />
      <row characterID="1427330454" characterName="Taemine" corporationID="98104433" corporationName="SUB ZERO." allianceID="1411711376" allianceName="Legion of xXDEATHXx" factionID="0" factionName="" />
    </rowset>
  </result>
  <cachedUntil>2014-07-25 21:11:49</cachedUntil>
</eveapi>```

Recent fix for row data missing attributes that were defined in the rowset

The fix / (commented ; hack ;) ) for row data missing attributes in the rowset seems to have broken some queries.

Running apitest to get alliances, and also a test to get killlog on a character, and getting char sheet info in apitest all return the following error;

Traceback (most recent call last):
File "C:/Python27/myevetest.py", line 38, in
kills_result=auth.char.Killlog(characterID=char.characterID)
File "C:\Python27\lib\site-packages\eveapi.py", line 274, in call
return self._root(self._path, **kw)
File "C:\Python27\lib\site-packages\eveapi.py", line 362, in call
return _ParseXML(response, True, store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
File "C:\Python27\lib\site-packages\eveapi.py", line 204, in _ParseXML
obj = _Parser().Parse(response, True)
File "C:\Python27\lib\site-packages\eveapi.py", line 410, in Parse
p.ParseFile(data)
File "C:\Python27\lib\site-packages\eveapi.py", line 485, in tag_start
if col == attributes[row_idx]:
IndexError: list index out of range

Rowset column have a name, row - doesn't always have an attribute with this name

While working with ContractItems API I've stumbled upon a bug - while columns attribute in rowset always contains name "rawQuantity", row doesn't.
Example XML:

<eveapi version="2">
<currentTime>2012-02-22 18:05:44</currentTime>
<result>
<rowset name="itemList" key="recordID" columns="recordID,typeID,quantity,rawQuantity,singleton,included">
<row recordID="643979193" typeID="16064" quantity="1" singleton="0" included="1"/>
</rowset>
</result>
<cachedUntil>2022-02-19 04:25:56</cachedUntil>
</eveapi>

In current implementation, attributes taken from row are not parsed, it is assumed that columns count in rowset is equal to attributes count in row (or less, but a fix for that is already implemented).
In this situation, columns in row are "shifted" and included column is not even created. Instead, rawQuality is filled with singleton value, and singleton is filled with included value.

I've created a quick hack to remedy this situation (and my Python skill is quite low, so it can be very inefficient), but just by pre-filling a list with zero integer values and then re-filling it by index of column name. I don't like this kind of solution and ask for a more proper variant instead (if any).

Quick (and dirty) fix below:

            # <hack>
            # - check for missing attributes while columns do exist!
            # very ugly hack and dunno what to do with zero values created
            # 
            if (len(attributes)/2 < len(self.container._cols)):
                hacklist=[0]*len(self.container._cols) #predef length!
                for i in xrange(0, len(attributes), 2):
                    hacklist[self.container._cols.index(attributes[i])]=_autocast(attributes[i], attributes[i+1])
                self.container.append(hacklist)
            else:
            # </hack>
                self.container.append([_autocast(attributes[i], attributes[i+1]) for i in xrange(0, len(attributes), 2)])

P.S. I'm not a native English speaker, so some wordings may be incorrect. Feel free to ask if something is not quite understandable.

Get errors trying to run apitest.py

Just downloaded eveapi as I haven't touched it in a while and I get this error:

[wonko@phone eve]$ ./apitest.py > apitest.out
./apitest.py:127: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
print "message:", e.message
Traceback (most recent call last):
File "./apitest.py", line 386, in
entriesByRefType = journal.entries.GroupedBy("refTypeID")
AttributeError: 'Element' object has no attribute 'entries'
[wonko@phone eve]$ python --version
Python 2.6.6
[wonko@phone eve]$

I'm new to python so I'm not even sure where to start looking.

Thank you for your time and your awesome project!

-brian

TypeError when running apitest.py

After replacing line 18 and 19 with my own (full access) key I ran the script and got this traceback:

Traceback (most recent call last):
  File "C:/dev/temp/apitest.py", line 370, in <module>
    me = cachedApi.auth(YOUR_USERID, YOUR_APIKEY).character(rich_charID)
TypeError: auth() takes exactly 1 argument (3 given)

HTTP error codes

I just noticed that Odyssey 1.0.1 started using http error codes instead of xml errorcodes to describe problems (patchnotes here) eveapi.py will just crash if a api-key is expired... (http 403 error)

a bug from Serenity server API

from Serenity server , Corporation ticker field not parse as a string.

https://api.eve-online.com.cn/corp/CorporationSheet.xml.aspx?corporationID=98000263

>>> api = eveapi.EVEAPIConnection("api.eve-online.com.cn")
>>> q=api.corp.CorporationSheet(corporationID=98000263)
>>> q.ticker
<eveapi.Element object at 0x039C8A90>`
>>> print q.ticker
<Element 'ticker'>

xml is

<?xml version='1.0' encoding='UTF-8'?>
<eveapi version="2">
  <currentTime>2014-11-02 19:41:23</currentTime>
  <result>
    <corporationID>98000263</corporationID>
    <corporationName>军情四处</corporationName>
    <ticker>Live </ticker>
    <ceoID>90000068</ceoID>
    <ceoName>rova3</ceoName>
    <stationID>60014659</stationID>
    <stationName>Kisogo VII - State War Academy</stationName>
    <description>在这里输入你军团的描述。</description>
    <url>http://eve.tiancity.com</url>
    <allianceID>0</allianceID>
    <factionID>0</factionID>
    <taxRate>1</taxRate>
    <memberCount>18</memberCount>
    <shares>1000</shares>
    <logo>
      <graphicID>0</graphicID>
      <shape1>415</shape1>
      <shape2>574</shape2>
      <shape3>415</shape3>
      <color1>0</color1>
      <color2>676</color2>
      <color3>0</color3>
    </logo>
  </result>
  <cachedUntil>2014-11-02 19:41:23</cachedUntil>
</eveapi>```

Python 3 support on pypi

This library supports python 3, and it's marked in setup.py, not on pypi. Not sure what needs to be done to update it, but it would be nice so that caniusepython3 reports correctly.

eveapi starbase detail not pulling correctly.

when pulling the starbase detail its not getting the proper data. specifically with this case

auth = api.auth(keyID=keyID, vCode=vCode)
s = auth.corp.StarbaseDetail(itemID=itemID)
cs = s.combatSettings

cs.dict
{'onCorporationWar': '', '_isrow': False, 'useStandingsFrom': '', 'onStandingDro
p': '', 'onStatusDrop': '', '_name': u'combatSettings', 'onAggression': ''}

at the very least useStandingsFrom shouldnt be a string it should have a child named ownerID which is the owner of the standings the pos is using. this is quite a problem for any pos managers using these datails.

Some small fixes and enhancements

Hello ntt,

again thank you very much for your blazing fast reaction with our bug reports :)

In our project : Eve Corp. Management we use a slightly patched version of eveapi and I think that we made changes that could be interesting for you and others.

Here is a patch of our changes: http://pastebin.com/aEC5bJHX

Basically we changed the following:

  • Added an optional scheme argument (that defaults to "https" to the EVEAPIConnection function (to allow plain HTTP).
  • Fixed a typo on line 361: except Error, reason: --> except Error, e:
  • The _autocast function now converts dates to real datetime objects (easier to manage in Python than a unix timestamp).
  • Added a MalformedXMLResponse exception that fires instead of the RuntimeError if the <eveapi> tag is not found.
  • the version attribute of the <eveapi> tag is now available through a <api_connection_obj>._meta.version attribute.

Feel free to integrate those changes in the official version :)

Also, and most important, we wanted to know if you'd be interested in helping on Eve Corp. Management. We would be thrilled if you were :-)

Thanks again for a wonderful piece of software!!!

diab

Empty attributes should be set to None

Came across a corp without a ticker

http://evemaps.dotlan.net/corp/Eve_Corporation_4547898734

When you try to print the ticker you get this:

CorporationID: <type 'int'> 98067143
Ticker: <class 'eveapi.Element'> <Element 'ticker'>
Name: <type 'unicode'> Eve Corporation 4547898734
AllianceID: <type 'int'> 99001163

XML snippet:

<corporationID>98067143</corporationID>
<corporationName>Eve Corporation 4547898734</corporationName>
<ticker />
<ceoID>1181977043</ceoID>
<ceoName>Uwant Mirriondorra</ceoName>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.