|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Entity
X-Factor Industries
|
Posted - 2007.07.10 10:55:00 -
[1]
Yesterday I released the Python EVE API wrapper I've been working on.
You can find it here: Python EVE API
This wrapper has no external dependencies and will work with any Python version from 2.4 onward, and will likely work with future versions of the EVE API.
An extensive demonstration script is provided.
Feel free to post suggestions for improvements and bug reports here, or mail me ingame.
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries
|
Posted - 2007.07.31 15:55:00 -
[2]
Originally by: foiblealt Getting errors when running apitest.py
Thanks. There appears to be a bug in the data returned by the API, not the actual eveapi.py. I have filed a bug report on this.
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries
|
Posted - 2007.11.22 13:50:00 -
[3]
heehee... yeah CCP keeps forgetting to pay the alliance bills it seems
Thanks for the feedback ♥
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2007.12.12 16:19:00 -
[4]
Edited by: Entity on 12/12/2007 16:20:17 Version 1.0.2 is now available, which fixes an issue with the new formatting of the XML.
I'm probably going to use a different parser for this in the next version because I do not like the current solution much
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2007.12.13 00:21:00 -
[5]
Edited by: Entity on 13/12/2007 00:22:41
Originally by: Macdeth Appears to bail on KillLog, CorporationSheet, and I think I saw it somewhere else but API server just went down as I was checking while composing this.
The KillLog error is indeed a bug in my code, and it's been fixed. v1.0.3 now available for download.
However it looks like CorporationSheet is missing the required columns attribute, which is a bug in the XML. I have informed Garthagk about this and it'll be fix0red SoonÖ
Thanks for pointing this out. _
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2007.12.22 08:51:00 -
[6]
Originally by: Invisible Hand Useful module, thanks for writing this!
Minor bug report: in _autocast() you do:
return int(mktime(strptime(s, "%Y-%m-%d %H:%M:%S")))
However the time strings are in UTC, while mktime expects a tuple in the local timezone. So the parsed values are not the expected seconds-since-epoch value unless your local timezone happens to match UTC. This means that (among other things) you can't just compare cachedUntil to time.time().
I changed my copy to use calendar.timegm() instead of time.mktime() and it works perfectly now - all the time values are parsed into seconds-since-epoch.
Hmm, not sure about this one; I convert my local time to UTC before comparing times, and I wanted the input times to stay exactly as they are (which mktime achieves)... I guess it depends on which way you look at the problem :)
I'm not really a fan of timezone stuff in programming, so I might very well be doing this the wrong way around... Comments, anyone?
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2007.12.23 13:09:00 -
[7]
Originally by: Invisible Hand Edited by: Invisible Hand on 22/12/2007 12:52:01 Note that without this change the simple&obvious caching mechanism used in apitest.py just doesn't work with any local timezone other than UTC.
Actually, it works fine since im using the server times and calculate seconds-til-expiry and add it to local time. Have you actually tried it?
Anyway, you have some valid points, I'll change the thing to use timegm().
_
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2007.12.23 13:32:00 -
[8]
Edited by: Entity on 23/12/2007 13:34:01
Originally by: Elandra Tenari Thanks for writing this, it's proving very useful.
One minor bug I found whilst processing KillLogs is that the raw Element for the Victim has no attributes. So I changed the if self.container._isrow: section of the tag_end function to pick up attributes on single elements.
My updated version here.
Cheers.
v 1.0.4 available for download (see top post) _
Got Item? | Ship? | Python EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.02.03 23:31:00 -
[9]
1.0.5 now available. see original post. _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.04.16 01:46:00 -
[10]
Edited by: Entity on 16/04/2008 01:47:35 Hm I should be paying more attention to this thread. Too bad this board doesn't let you "subscribe" to threads.
Anyway...
Originally by: Flios Bror
What is the syntax for getting the next page, of for example the WalletJournal. I know it's an exercise for the reader, but I didn't manage to find the documentation for this in the library source-code yet.
You simply add the appropriate beforeRefID=X (where X is the refID of the last/oldest entry of the last query) to the subsequent query.
Originally by: Flios Bror How can I get the date+times for the currentTime and the cachedUntil from a element-object returned from a query?
the currentTime and cachedUntil are available through the _meta attribute on the result root, like this:
result = api.blablabla() foo = result._meta.currentTime
Originally by: Flios Bror Last a more general API-question: when several accounts have access to corporate WalletJournal, is the caching-time for everyone at the same time, or is it for each account seperately?
Not sure, there's a lot of different caching schemes used :-/
Originally by: Kanmahr Great work. There does however seem to be a problem with the trained to level of a skill. The values the API returns seem to be one over the current level. Currently working around it but would be nice to fix :)
Seeing as this wrapper does not have any code that deals with skill levels, nor have any knowledge of the methods exposed by the server, it's problem CCP would have to fix (if it's still the case)
Originally by: Demiurgis will most of this work with a limited API key?
Limited keys only give limited access! (who would have guessed?) You can do plenty of fun stuff with limited keys though. Check the API reference
Thanks everyone, for the feedback :) _
Got Item? | EVE API? |
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.07.12 11:04:00 -
[11]
Originally by: bowindah Nice wrapper.
I am trying to use it with AssetList which returns nested rowsets.
The following works, for asset in result2.assets: self.response.out.write("%s<br/>" % asset)
Sometimes it returns, Row(itemID:271302566,locationID:61000108,typeID:588,quantity:1,flag:4,singleton:1,contents:Rowset(columns=[itemID,typeID,quantity,flag,singleton], rows=3)) whereas other times it returns, Row(itemID:561829276,locationID:61000108,typeID:11489,quantity:1,flag:4,singleton:1,contents:None)
So my question is, how to test and enumerate over the nested Rowset?
Either use a recursive function to walk the tree, or use the flat list. The flat list is easier to process in most cases. Just do blablabla.AssetList(flat=1)
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.07.18 12:02:00 -
[12]
Just uploaded the 1.0.6 release.
Apparently I had forgotten to enable text buffering on the xml parser so it was possible for text content to be cut because it wasn't prepared to handle multiple parts for the same content. Fixed now :)
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.09.23 10:32:00 -
[13]
Anti-Thread-AutoLock bump :)
Also note that while this api module does not seem to be updated when CCP adds new api methods, it will happily work with those. |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.11.13 16:52:00 -
[14]
There is currently a problem getting the character sheet. The rowset containing the certificates is missing a required attribute (columns). This is not an eveapi.py bug. _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.11.14 01:03:00 -
[15]
Originally by: Dragonaire I'd say counting on have a columns field is a bug myself ;) There has been/are still other APIs that don't have it. Without a formal DTD or something from CCP you can't really call it wrong for it not to be there.
Uneducated response is uneducated.
What if you get an empty set but still want the columns to display in a list in an application?
Not to mention I helped Garthagk out back when he was designing this thing, so I think I am more than qualified to call it wrong for it not to be there.
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.11.14 12:38:00 -
[16]
Originally by: Dragonaire Don't think the flaming was called for
Heh, you call that flaming already? You're essentially considering my lib bugged and I can't make a counter comment? Lighten up
Originally by: Dragonaire and if you were so involved then why didn't you make a DTD or XSD and release it? That would have not only help all the third party developers but also the people that followed you when adding new stuff to API.
There were limits to my involvement, obviously. It was just discussed in an IRC channel with a few other people. DTD/XSD would have been nice, yes.
Originally by: Dragonaire As far as using the columns stuff to title page columns I don't do that because that would be mixing model and view which is usually considered bad form in MVC and doesn't let you have as much control over what fields you might want to show the users.
Sure. I just took a random example. There are plenty of reasons for wanting to know the columns before the actual data comes up anyway.
Originally by: Dragonaire Next time you might try explain why you think it's a bug not attack someone for pointing out what sounds like a false assumption or statement to them for you to be making.
Seriously though. Even ignoring all that, there is still the fact that every single other rowset tag has the columns attribute, so I'd take the bet it's a bug any day.
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.11.14 15:10:00 -
[17]
Originally by: Dragonaire No problem Entity guess for my part the 'Uneducated response is uneducated.' comment just struck a nerve with me
Sorry =^.^=
Anyway, there's some merit in working around this issue, and it was a simple workaround, so I've updated the module (see OP).
# Version: 1.0.7 - 14 November 2008 # - Added workaround for rowsets that are missing the (required!) columns # attribute. If missing, it will use the columns found in the first row. # Note that this is will still break when expecting columns, if the rowset # is empty [Flux/Entity] #
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2008.11.22 12:46:00 -
[18]
Originally by: Chop Shop
Quote:
# You may specify a default to return in case the row wasn't found: print alliances_by_ticker.Get("123456", 42)
# If no default was specified and you try to look up a key that does not # exist, an appropriate exception will be raised: try: print alliances_by_ticker.Get("123456") except KeyError: print "This concludes example 5"
..and I guess the failsafe? of 123456 is something I would edit to be an existing alliance ticker? like BOB or OHGOD ?
Below is the python shell output I got -- I assume the output may be academic to you but I am working with the API and python for the first time.
Having said that, what is the significance of the ",42" above? Just wondering if I need to fiddle with that if I chance the alliance ticker..
The second argument to Get() is .. well, like the example says already, the default. It just provides you with an interface almost identical to the get() method on dictionaries. I just used the alliances thing here to demonstrate it, but it might as well have been this:
usernameByID = {1: "john", 2: "mark"} x = 3 name = usernameByID.get(x, "guest")
versus
usernameByID = {1: "john", 2: "mark"} x = 3 try: name = usernameByID[x] except KeyError: name = "guest"
Of course if one doesn't handle the exception, like what happens here:
Originally by: Chop Shop
Quote:
Traceback (most recent call last): File "Q:\eve_api_py_107\apitest.py", line 239, in <module> print alliances_by_ticker.Get("ISD") File "Q:\eve_api_py_107\eveapi.py", line 614, in Get raise KeyError, key KeyError: 'ISD' >>>
Then, well... Let's just say the example isn't supposed to do that.
The problem here is that CCP appears to have the habit of letting the ISD alliance expire I used ISD in the example assuming it to be a permanent entry in the database, but it isn't :D
Just change it to something that exists to fix that
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.01.15 23:03:00 -
[19]
Version 1.1.0 is now available! (see OP for location)
# Version: 1.1.0 - 15 Januari 2009 # - Added Select() method to Rowset class. Using it avoids the creation of # temporary row instances, speeding up iteration considerably. # - Added ParseXML() function, which can be passed arbitrary API XML file or # string objects. # - Added support for proxy servers. A proxy can be specified globally or # per api connection instance. [suggestion by graalman] # - Some minor refactoring. # - Fixed deprecation warning when using Python 2.6.
the apitest.py test script has also been updated to show the use of Select()
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.03.21 16:54:00 -
[20]
Skillqueue works fine as far as I know. It's just CCP using the incorrect XML formatting for the elements (should use rowsets), so I'm kind of waiting for CCP to correct this (I've made them aware of the problem), as fixing this in the api module would require making it aware of the SkillQueue method, which completely goes against the "anonymous" nature of the design.
As a workaround you can check whether there's just 1 skill element or a rowset. It's only 2-3 lines of code ;-)
_
Got Item? | EVE API? |
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.03.23 14:49:00 -
[21]
They actually fixed it? omg _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.05.31 21:14:00 -
[22]
Well, it's been a few months and it's still working fine!
(anti thread lock bump)
Oh, anyone using Python 3 btw? I might consider making a version for that. _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.07.28 00:47:00 -
[23]
Originally by: Alyzza Is it possible to retrieve the corporation sheet through the api without authenticating? The corp sheet should be available without limited key.
>>> api.corp.CorporationSheet() Error: Must provide userID parameter for authentication
Nope. blame CCP :P _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.07.28 00:48:00 -
[24]
Originally by: Ilyk Halibut Any chance we could get a Google Code project set up for this?
Not sure if there's a point for such a tiny snippet of code.
I'll consider it for next version (if/when that comes), though. Maybe add a setup.py etc. _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.09.13 13:41:00 -
[25]
Originally by: SPACE L0RD
KeyError: 'Expanded Cargohold II'
Uh yeah, you're supposed to fill in something you sold instead of Expander IIs ;)
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.10.03 02:47:00 -
[26]
Originally by: Xyfu
for i in chars.characters: if charnom == i.name: charID = i.characterID break
charnom is user input, and chars is auth.account.Characters(). For some reason, charnom == i.name never evaluates true. Halp plix?
It is case sensitive, so that might be it ;) _
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.10.03 03:06:00 -
[27]
Originally by: Xyfu
Originally by: Entity It is case sensitive, so that might be it ;)
Huh? Which bit? >:
Your name? Either fix charnom to spell your name with the correct case, or just do if charnom.lower() == i.name.lower().
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.10.03 03:22:00 -
[28]
Edited by: Entity on 03/10/2009 03:21:51 yeah well... check the example here. that has the same construct you're using and that works fine, so you must be doing something wonky with your input :P
_
Got Item? | EVE API? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2009.12.11 15:38:00 -
[29]
I assume there's no problems with the library and the new API methods then? :) _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.01.10 16:21:00 -
[30]
Version 1.1.1 released (see OP).
This fixes corp.MemberSecurity (which did not properly return all data on members)
|
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.04.02 12:36:00 -
[31]
The usual anti-thread-expire bump! :) |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.07.01 02:04:00 -
[32]
Edited by: Entity on 01/07/2010 02:13:38
Originally by: Meldgaard And i fund the bug: Eve api is utf-8 and the parser is using unicode strings.
Here is a quick and dirty fix: http://eveapi.rasmusm.dk/eveapi-utf-8.patch
Hm?. I'm not quite sure that is actually a bug. See, it's up to the implementor to output with the correct encoding for the target (in your case a console window). The objects returned by the parser are supposed to be regular/unicode strings. If you encode them they technically stop being strings and start being binary data that just so happens to be some representation of said string.
Edit: Oh and welcome to the headache that is python and encodings. _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.07.01 23:52:00 -
[33]
Edited by: Entity on 01/07/2010 23:55:20
Originally by: Meldgaard The problem is (as i understand it, because yes this is my first time with utf-8 in python) that the eveapi are returning strings in uft-8, but in _Parser.__str__ you are calling str() on the variable holding the utf-8 string, this will cast an exception if the utf-8 string do include char outside of unicode (like in the description of the ccp created event about the ore primae)
Ah, well there -is- a bug but it's actually in the __str__ and not in the autocast function. To be honest the Row string representation was not really meant to be used for anything other than debugging stuff, but of course that has to work properly as well. I've fixed it and put the new version up on git.
The change doesn't make your code run as is though. You just can't print unicode stuff without providing an encoding for it. So, if you get the new eveapi.py, you still have to do this to actually output it to a console window:
print unicode(event).encode("utf8") (unicode characters that have no ascii mapping will be unreadable though, as they'll be ... encoded :).
_
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.08.27 22:22:00 -
[34]
Originally by: Nuran DeSiad Hi,
I'm quite new with the whole API thing...I wanted to start out with the Python eveapi to write some scripts for my own use...Python is also new to me...so please bear with me if I talk rubbish :)
My problem:
When I try to run the 'example.py' , I get the following errors:
./example.py: line 3: watchList: command not found ./example.py: line 4: [1234567,: command not found ./example.py: line 6: ]: command not found ./example.py: line 8: syntax error near unexpected token `(' ./example.py: line 8: `api = eveapi.EVEAPIConnection()'\
I've added the userid and api key and the name to the script as described, and placed the eveapi.py in the site-packages directory. The python version I use is 2.6.4 on a Fedora 13 host. Anyone a tip ?
Try running it with python and not bash ;)
_
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.08.29 00:41:00 -
[35]
Edited by: Entity on 29/08/2010 00:41:42
Originally by: Nuran DeSiad Hi Entity,
Thanks...I was so fixed on this that I overlooked it...Anyway...when I run 'python example.py', it chokes again, and returns this message:
python example.py Traceback (most recent call last): File "example.py", line 1, in <module> import eveapi File "/home/andy/Projects/eveapi.py", line 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ^ SyntaxError: invalid syntax
cheers, Nuran
Try copying the api module as text instead of html.
(are we going to keep doing this?) _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.11.08 02:17:00 -
[36]
1.1.3 available. Fixes char/MailBodies. _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.11.09 00:20:00 -
[37]
Originally by: XennoX268 I'm getting hit by the following error when trying to use the test script.
---
EXAMPLE 2: GETTING WALLET BALANCE OF ALL YOUR CHARACTERS
Traceback (most recent call last): File "C:\Users\me\Desktop\EVE API Project\eveapi.py", line 176, in _ParseXML raise Error(error.code, error.data) Error: Authentication failure
Reading line 17 might help. _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.11.09 11:16:00 -
[38]
Originally by: XennoX268
Originally by: Entity
Originally by: XennoX268 I'm getting hit by the following error when trying to use the test script.
---
EXAMPLE 2: GETTING WALLET BALANCE OF ALL YOUR CHARACTERS
Traceback (most recent call last): File "C:\Users\me\Desktop\EVE API Project\eveapi.py", line 176, in _ParseXML raise Error(error.code, error.data) Error: Authentication failure
Reading line 17 might help.
Except, I've put my userID plus full API key into the script, and checked it multiple times.
Really, it works fine. I run that script before every release.
The error you get is a server-side response that you only get when there is something wrong with the credentials (or account status, perhaps).
_
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2010.12.01 10:05:00 -
[39]
1.1.4 now available, which fixes empty CDATA not being handled (e.g. empty mail bodies)
_
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.05.27 13:26:00 -
[40]
New update
# Version: 1.1.6 - 27 May 2011 # - Now supports composite keys for IndexRowsets. # - Fixed calls not working if a path was specified in the root url. _
Got Item? | EVE API? | Cache? |
|
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.05.28 18:59:00 -
[41]
Woops my bad. Updated. _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.06.21 17:51:00 -
[42]
Originally by: Yinmatook I am starting to play with this on a Mac using python 2.6.6, and the apitest.py is aborting with the following:
EXAMPLE 7: TRANSACTION DATA (and doing more nifty stuff with rowsets)
[3] /char/WalletJournal.xml.aspx: not cached, fetching from server... [3] /char/WalletJournal.xml.aspx: cached (632 seconds) Traceback (most recent call last): File "./apitest.py", line 385, in <module> entriesByRefType = journal.entries.GroupedBy("refTypeID") AttributeError: 'Element' object has no attribute 'entries'
Is this expected, is this because I'm on a mac? I'm just starting to figure out this API stuff, want to build some apps for my corp and I'm sort of lost (I hope that's normal when we start doing this stuff).
Thanks, Yin
Nah. try replacing 'entries' with 'transactions'. I think they just renamed the table :P
_
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.09.01 22:06:00 -
[43]
1.1.8 now available.
# Version: 1.1.8 - 1 September 2011 # - fix for inconsistent columns attribute in rowsets. # # Version: 1.1.7 - 1 September 2011 # - auth() method updated to work with the new authentication scheme. _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.09.02 00:31:00 -
[44]
Originally by: diabeteman Edited by: diabeteman on 02/09/2011 00:18:03 EDIT: You read my mind!!! You fixed it as I was posting this
Hehe. I keep having to clean up after CCP's bugs. Every patch seems to get a new dev assigned to do api stuff, who ends up making the same mistakes as his predecessor(s).
Current CCP fails (HI CCP, ARE YOU READING THIS? :): - There is a space in the columns= attribute in rowsets for MemberSecurity page. - rowsets were not designed for conditional columns like rawQuantity in AssetList. More of those in the same table would render it extremely hard to parse without special-casing. Right now eveapi is context-free and I would like to keep it that way.
Originally by: diabeteman I've been using evapi for over 2 years now and I must say : YOU ROCK!
Why thank you, Sir! _
Got Item? | EVE API? | Cache? |
Entity
X-Factor Industries Synthetic Existence
|
Posted - 2011.09.08 18:14:00 -
[45]
New forums thread: https://forums.eveonline.com/default.aspx?g=posts&t=6504 _
Got Item? | EVE API? | Cache? |
|
|
|