predictionio seems to be misreading my arguments

106 views Asked by At

I am using python to import data onto a server running predictionio.
I am using the following code to set up the EventClient:

import predictionio
client = predictionio.EventClient(
    access_key='285',
    url='http://localhost:7070',
    threads=5,
    qsize=500)

client.create_event(
                event="rate",
                entity_type="user",
                entity_id="Bob",
                target_entity_type="item",
                target_entity_id="Fred",
                properties= { "rating" : 5.0 }
            ) 

However I keep getting the following message:

python imp.py
Traceback (most recent call last):
  File "imp.py", line 6, in <module>
    qsize=500)
  File "C:\...\predictioni
    "It seems like you are specifying an app_id. It is deprecate
DeprecationWarning: It seems like you are specifying an app_id.
ss_key instead. Or, you may use an earlier version of this sdk.

I'm clearly not specifying an app id, as I'm passing the client a named argument: "access_key". Removing the qsizeargument does nothing, the error just gets blamed on the line above, and so on. I can't find anything in the documentation and it's probably because I'm so new to all of this that I can't find out where I'm going wrong.
All of the tutorials I have been looking at create EventClients in this way and it works no problem:
http://predictionio.incubator.apache.org/datacollection/eventapi/
Any help would be greatly appreciated. Thanks.

1

There are 1 answers

8
OneCricketeer On

access_key must be greater than 8 characters long.

Source code

class EventClient(BaseClient):

  def __init__(self, access_key,
      url="http://localhost:7070",
      threads=1, qsize=0, timeout=5, channel=None):
    assert type(access_key) is str, ("access_key must be string. "
        "Notice that app_id has been deprecated in Prediction.IO 0.8.2. "
        "Please use access_key instead.")

    super(EventClient, self).__init__(url, threads, qsize, timeout)

    # SEE HERE...

    if len(access_key) <= 8:
      raise DeprecationWarning(
          "It seems like you are specifying an app_id. It is deprecated in "
          "Prediction.IO 0.8.2. Please use access_key instead. Or, "
          "you may use an earlier version of this sdk.")

For example

>>> client = predictionio.EventClient(access_key='12345678')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/env/py2/lib/python2.7/site-packages/predictionio/__init__.py", line 178, in __init__
    "It seems like you are specifying an app_id. It is deprecated in "
DeprecationWarning: It seems like you are specifying an app_id. It is deprecated in Prediction.IO 0.8.2. Please use access_key instead. Or, you may use an earlier version of this sdk.
>>> client = predictionio.EventClient(access_key='123456789')
>>>