open All Channels
seplocked EVE Technology Lab
blankseplocked Advanced Python EVE API wrapper
 
This thread is older than 90 days and has been locked due to inactivity.


 
Pages: 1 2 [3] 4

Author Topic

Alyzza
Ono-Sendai Limited
Posted - 2009.08.12 21:39:00 - [61]
 

There seems to be a bit of a "bug" when corporations have bytes in their description which can't be encoded as unicode. Case and point: http://api.eve-online.com/corp/CorporationSheet.xml.aspx?corporationID=639241770

When retrieveing that, I get an UnicodeEncodeError. Stacktrace:
File "/home/kriberg/kode/leve/leve/../leve/core/eveapi.py" in __call__
228. return self._root(self._path, **kw)
File "/home/kriberg/kode/leve/leve/../leve/core/eveapi.py" in __call__
301. return _ParseXML(response, True, store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
File "/home/kriberg/kode/leve/leve/../leve/core/eveapi.py" in _ParseXML
156. obj = _Parser().Parse(response, False)
File "/home/kriberg/kode/leve/leve/../leve/core/eveapi.py" in Parse
348. p.Parse(data, True)

Don't know if there's a sane way to handle it either. In this case, I tried enclosing it in a try/except, but the exception probably comes when parsing the entire response. Would be nice if I didn't need to discard the entire response. Perhaps it could per default set the current property to 'unicode error' or something.

Amerilia
Posted - 2009.08.17 16:12:00 - [62]
 

Edited by: Amerilia on 17/08/2009 16:47:00


SPACE L0RD
Gallente
Posted - 2009.09.11 02:15:00 - [63]
 

I get the following when running the apitest.py script on my system (Mac OSX 10.6.1). Using Python 2.6.1.

------------------

EXAMPLE 6: CACHING DATA

[1] /eve/SkillTree.xml.aspx: retrieving from disk
[1] /eve/SkillTree.xml.aspx: returning cached document
[2] /eve/SkillTree.xml.aspx: returning cached document

EXAMPLE 7: TRANSACTION DATA
(and doing more nifty stuff with rowsets)

[3] /char/WalletJournal.xml.aspx: retrieving from disk
[3] /char/WalletJournal.xml.aspx: returning cached document
You paid a 3923822.47 ISK transaction tax since Sat Jun 13 19:52:00 2009
[4] /char/WalletTransactions.xml.aspx: retrieving from disk
[4] /char/WalletTransactions.xml.aspx: returning cached document
Traceback (most recent call last):
File "apitest.py", line 406, in <module>
for row in soldTx.GroupedBy("typeName")[typeName]:
File "/Users/bart/Development/Python/eveapi.py", line 766, in __getitem__
return Rowset(self._cols, self._items[i])
KeyError: 'Expanded Cargohold II'

Entity
X-Factor Industries
Synthetic Existence
Posted - 2009.09.13 13:41:00 - [64]
 

Originally by: SPACE L0RD

KeyError: 'Expanded Cargohold II'



Uh yeah, you're supposed to fill in something you sold instead of Expander IIs ;)

Xyfu
Minmatar
Love From Above
Posted - 2009.10.03 02:45:00 - [65]
 

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?

Entity
X-Factor Industries
Synthetic Existence
Posted - 2009.10.03 02:47:00 - [66]
 

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 ;)

Xyfu
Minmatar
Love From Above
Posted - 2009.10.03 03:03:00 - [67]
 

Originally by: Entity
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 ;)


Huh? Which bit? >:

Entity
X-Factor Industries
Synthetic Existence
Posted - 2009.10.03 03:06:00 - [68]
 

Originally by: Xyfu
Originally by: Entity
It is case sensitive, so that might be it ;)


Huh? Which bit? >:


Your name? Rolling Eyes
Either fix charnom to spell your name with the correct case, or just do if charnom.lower() == i.name.lower().


Xyfu
Minmatar
Love From Above
Posted - 2009.10.03 03:10:00 - [69]
 

Originally by: Entity


Your name? Rolling Eyes
Either fix charnom to spell your name with the correct case, or just do if charnom.lower() == i.name.lower().




Oh right, yeah, I know it's case sensitive, I was wary of that. With some print statements about, I had a bit of a promble.

Please select the CEO from the above list:  Xyfu
<type 'str'> <type 'unicode'> Xyfu Xyfu Xyfu

Xyfu
Select a CEO blah blah blah:


The print statement lists: input type, i.name type, input, i.name, str(i.name). Also tried messing around with str(...) and unicode(...)s in the if, but to no avail.

Entity
X-Factor Industries
Synthetic Existence
Posted - 2009.10.03 03:22:00 - [70]
 

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

Xyfu
Minmatar
Love From Above
Posted - 2009.10.03 17:48:00 - [71]
 

Edited by: Xyfu on 03/10/2009 20:52:01
Originally by: Entity
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



Ok, I've no idea why, but my break wasn't working properly, causing the while True to keep going, even though I'd gotten my charID. Oh well.

Love your module, by the way, if I had any items you didn't, I'd happily donate them.

EDIT: Oh christ, most of the problems I had were because the Python Shell wasn't resetting, and clearing variables etc. All fixed now, yay for the command prompt.

Entity
X-Factor Industries
Synthetic Existence
Posted - 2009.12.11 15:38:00 - [72]
 

I assume there's no problems with the library and the new API methods then? :)

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.01.10 16:21:00 - [73]
 

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 - [74]
 

The usual anti-thread-expire bump! :)

medecau
Gallente
Super Bock Preta
Posted - 2010.04.24 08:54:00 - [75]
 


Meldgaard
Agony Unleashed
Agony Empire
Posted - 2010.06.30 22:39:00 - [76]
 

Edited by: Meldgaard on 30/06/2010 22:49:11
Originally by: Alyzza
There seems to be a bit of a "bug" when corporations have bytes in their description which can't be encoded as unicode.


I have the same error just with the ccp event in char/UpcomingCalendarEvents.xml.aspx:
Row(eventID:37679,ownerID:793028819,ownerName:Agony Unleashed,eventDate:1277985600,eventTitle:api test ignore,duration:180,importance:0,response:Undecided,eventText:test1 )
Traceback (most recent call last):
File "./eveapibug.py", line 28, in <module>
print event
File "/home/rasmusm/local/src/evegate2ical/eveapi.py", line 557, in __str__
return "Row(" + ','.join(map(lambda k, v: "%s:%s" % (str(k), str(v)), self._cols, self._row)) + ")"
File "/home/rasmusm/local/src/evegate2ical/eveapi.py", line 557, in <lambda>
return "Row(" + ','.join(map(lambda k, v: "%s:%s" % (str(k), str(v)), self._cols, self._row)) + ")"
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 178: ordinal not in range(128)

this test code (and test xml on my test server) gives the error:

EDIT: arg its a bad forum, you can get the file here: http://eveapi.rasmusm.dk/eveapibug.py
MORE EDIT: I am using Python 2.6.5 and eveapi 1.1.1

Meldgaard
Agony Unleashed
Agony Empire
Posted - 2010.06.30 23:14:00 - [77]
 

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

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.07.01 02:04:00 - [78]
 

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.

Meldgaard
Agony Unleashed
Agony Empire
Posted - 2010.07.01 09:47:00 - [79]
 

Originally by: Entity
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.


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)

PS. I forgot to say thank you for making this nice api wrapper, other than this but (and i blame utf-8) its a pleasure to be working with.

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.07.01 23:52:00 - [80]
 

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 :).

Nuran DeSiad
Gallente
Plain Trash
Posted - 2010.08.27 14:29:00 - [81]
 

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 ?


Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.08.27 22:22:00 - [82]
 

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 ;)

Nuran DeSiad
Gallente
Plain Trash
Posted - 2010.08.28 20:48:00 - [83]
 

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

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.08.29 00:41:00 - [84]
 

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?)

Nuran DeSiad
Gallente
Plain Trash
Posted - 2010.08.30 08:16:00 - [85]
 

Thnx Entity, it works ok now...sorry for my clumsy questions...I should've looked a little further myself...

Anyway, thanks again, I'm off to play with the api now ! :)

cheers,
Nuran

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.11.08 02:17:00 - [86]
 

1.1.3 available. Fixes char/MailBodies.

XennoX268
Caldari
Big Johnson's
Posted - 2010.11.08 08:36:00 - [87]
 

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\apitest2.py", line 79, in <module>
result2 = auth.account.Characters()
File "C:\Users\me\Desktop\EVE API Project\eveapi.py", line 240, in __call__
return self._root(self._path, **kw)
File "C:\Users\me\Desktop\EVE API Project\eveapi.py", line 325, in __call__
return _ParseXML(response, True, store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
File "C:\Users\me\Desktop\EVE API Project\eveapi.py", line 176, in _ParseXML
raise Error(error.code, error.data)
Error: Authentication failure

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.11.09 00:20:00 - [88]
 

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. Rolling Eyes

XennoX268
Caldari
Big Johnson's
Posted - 2010.11.09 09:07:00 - [89]
 

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. Rolling Eyes


Except, I've put my userID plus full API key into the script, and checked it multiple times.

Entity
X-Factor Industries
Synthetic Existence
Posted - 2010.11.09 11:16:00 - [90]
 

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. Rolling Eyes


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).



Pages: 1 2 [3] 4

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only