albertyw / itolapi

Python API for the Interactive Tree of Life (iTOL)
MIT License
35 stars 11 forks source link

Error uploading tree to iTOL #21

Closed brettChapman closed 6 years ago

brettChapman commented 6 years ago

Hi

I'm trying to use the iTOL API to access iTOL through Python and it seems that the code isn't up to date with the new iTOL version 3, as I've been getting this error message:

There was an error:ITOL VERSION 2 BATCH IS NO LONGER AVAILABLE. PLEASE USE THE CURRENT VERSION.

The iTOL API is still linked to from the iTOL web site. Are there any plans to update the python iTOL API so that it can work with the latest version of iTOL?

Thanks.

Brett

albertyw commented 6 years ago

I also got an email for

Dear Albert,

I’m contacting you in relation to an error I recently got while trying to upload some trees and metadata to itol using the itolapi. I used itolapi about 3 months ago successfully (great api btw) but now it doesn’t work for me anymore. It’d be really appreciated if you could provide some help.

I get this error:

ITOL VERSION 2 BATCH IS NO LONGER AVAILABLE. PLEASE USE THE CURRENT VERSION.

I have tried changing the “itol2.embl.de” part of the scripts to “itol.embl.de” but now get another error:

‘ERR 0: zipFile is required'

Which I can see why in the http://itol.embl.de/help.cgi guide but solution goes by using a different set of scripts.

I’d be very thankful if you could let me know whether this error has to do with itol website, itolapi, or maybe something I’m doing wrong.  

Thank you in advance,

Rodrigo

I'll take a look at this soon.

albertyw commented 6 years ago

This has been fixed in https://github.com/albertyw/itolapi/releases/tag/v2.0.0. This now updates itolapi to itol v4.

Update with pip install --upgrade itolapi

PollyTikhonova commented 4 years ago

Dear @albertyw , I am facing up with a error ‘ERR 0: zipFile is required' during my python post request. Maybe you could help me to figure out, what am I doing wrong?


UPLOAD_URL = "http://itol.embl.de/batch_uploader.cgi"
respond = requests.post(UPLOAD_URL, data=args, files={'zipFile':open(zfile, `'rb')})```
albertyw commented 4 years ago

@PollyTikhonova I think your zfile is missing, empty or otherwise incorrect.

PollyTikhonova commented 4 years ago

@albertyw thank you for your reply! But if it was missing, Python would notify me about it at the moment of opening zfile. And I tested, when the parameter 'zipFile' is sent with incorrect data, the server respond with another error. So, this error means that python did not sent the parameter in a correct way, but I have no idea what's wrong.

albertyw commented 4 years ago

What version of the requests package are you using?

PollyTikhonova commented 4 years ago

requests 2.21.0, Python 3.7.1

albertyw commented 4 years ago

You need to switch your upload url to use https instead of http

PollyTikhonova commented 4 years ago

Oh my God! Thank you!!! It worked!