menorki / python-calais

Automatically exported from code.google.com/p/python-calais
0 stars 0 forks source link

"request has missing or invalid parameters" #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the demo outlined in the readme

Instead of getting a response, I receive the following:
ValueError: Invalid request format - the request has missing or invalid
parameters

This is with v1.4 of python-calais, running python 2.5 on mac os x 10.5

Original issue reported on code.google.com by peter.la...@gmail.com on 13 Jan 2009 at 6:00

GoogleCodeExporter commented 9 years ago
Please provide more details.  

Original comment by s3x...@gmail.com on 14 Jan 2009 at 2:58

GoogleCodeExporter commented 9 years ago
I am running the example from the HOWTO:

from calais import Calais
API_KEY = "my_key"
calais = Calais(API_KEY, submitter="my app")
result = calais.analyze("George Bush was the President of the United Statesof 
America
until 2009.  Barack Obama is the new President of the United States now.")

I've confirmed the key is correct. I get a ValueError when I try to analyze:

ValueError: Invalid request format - the request has missing or invalid 
parameters

module body   in app.py at line 6
function analyze      in calais.py at line 81
function __init__     in calais.py at line 119

Original comment by peter.la...@gmail.com on 14 Jan 2009 at 3:17

GoogleCodeExporter commented 9 years ago
Hello Peter,

That's pretty strange.  This error is returned by OpenCalais, which means that 
you do
got _some_ communication with them, but I've no idea why you're getting the 
"invalid
parameters" crap.  

Let's do some debugging.  Insert a "print params" statement between lines 40 
and 41
in calais.py (that's between the first and second line of the rest_POST() 
method of
the Calais() class).  Do a sample run, and let me know what that print statement
spits out.  Make sure you blank out your API KEY before you paste that result 
(it
will be in the 'licenseID' parameter).  

~ Jordan

Original comment by s3x...@gmail.com on 14 Jan 2009 at 5:45

GoogleCodeExporter commented 9 years ago
Sorry to waste your time -- must have been a key error I didn't notice (even 
after
confirming it!). I get a response now.

It would be nice if the response from calais was more specific.

Thanks!

Original comment by peter.la...@gmail.com on 14 Jan 2009 at 5:59

GoogleCodeExporter commented 9 years ago
All is well that ends well :)

Original comment by s3x...@gmail.com on 14 Jan 2009 at 9:19

GoogleCodeExporter commented 9 years ago
I am now getting this very same issue. It was working on Friday, and as far as 
I can
tell I have no changed my usage of the module.

The parameters (prior to urlencoding - little easier on the eyes) being sent 
are:

{'content': 'Reuters could not write a decent API if their life depended on 
it.',
 'licenseID': '<censored>',
 'paramsXML': '\n<c:params xmlns:c="http://s.opencalais.com/1/pred/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <c:processingDirectives
c:outputFormat="application/json" c:calculateRelevanceScore="true"
c:omitOutputtingOriginalText="true" c:contentType="TEXT/RAW">
</c:processingDirectives> <c:userDirectives c:submitter="python-calais client 
v.1.4"
c:allowSearch="false" c:allowDistribution="false"> </c:userDirectives>
<c:externalMetadata > </c:externalMetadata> </c:params>\n'}

Original comment by wrboyce on 14 Sep 2009 at 2:22

GoogleCodeExporter commented 9 years ago
Would appear if the key is wrong, that's the error OpenCalais will throw at you.

Pretty crap that (on Reuter's part); might be worth a wiki entry.

Original comment by wrboyce on 14 Sep 2009 at 2:28

GoogleCodeExporter commented 9 years ago
Confused me too. I'd mis-pasted the key. Googling the error brings this page 
up, at least :)

Original comment by danbri2...@danbri.org on 27 Jan 2011 at 11:49

GoogleCodeExporter commented 9 years ago
result.entities[0]["name"]

will print the detected named entities, how can i access entities and their 
types?? plz...reply n help..me...

Original comment by happy.pr...@gmail.com on 31 Mar 2011 at 4:26