Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error requesting access token #33

Closed
bkvaluemeal opened this issue Oct 13, 2016 · 5 comments
Closed

Error requesting access token #33

bkvaluemeal opened this issue Oct 13, 2016 · 5 comments

Comments

@bkvaluemeal
Copy link

I received this error when following the instructions on the readme. This had to have happened within the past month or so because I have v0.2.1 on my laptop and it worked just fine.

Python 3.5.2 (default, Sep 10 2016, 08:21:44) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from clarifai.client import ClarifaiApi
>>> 
>>> clarifai_api = ClarifaiApi()
>>> 
>>> result = clarifai_api.tag_images(open('/home/bkvaluemeal/Downloads/test.jpg', 'rb'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 239, in tag
    language=language)
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 605, in _multi_data_op
    media = self._process_files(files)
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 526, in _process_files
    self._check_batch_size(input_files)
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 550, in _check_batch_size
    self.get_info()  # sets the image size and other such info from server.
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 173, in get_info
    self._get_json_headers, self._get_json_response, url, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 674, in _get_raw_response
    headers = header_func()
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 660, in _get_json_headers
    headers = self._get_authorization_headers()
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 653, in _get_authorization_headers
    access_token = self.get_access_token()
  File "/usr/local/lib/python3.5/dist-packages/clarifai/client/client.py", line 151, in get_access_token
    req = urllib2.Request(url, data, headers)
  File "/usr/lib/python3.5/urllib/request.py", line 269, in __init__
    self.full_url = url
  File "/usr/lib/python3.5/urllib/request.py", line 295, in full_url
    self._parse()
  File "/usr/lib/python3.5/urllib/request.py", line 324, in _parse
    raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'api.clarifai.com/v1/token/'
@bkvaluemeal
Copy link
Author

It appears the only problem is that https:// is not appended to the URL. I will look further into this later today if someone else doesn't beat me to it.

Take a look at line 112.

@robertwenquan
Copy link
Contributor

This is a knonw issue with the last version. Please upgrade the client with pip install clarifai==2.0.4 and it's fixed.

@bkvaluemeal
Copy link
Author

Actually, yes. I just noticed that. My apologies, but I am using v2.04.

$ pip3 search clarifai
clarifai (2.0.4)  - Clarifai API Python Client
  INSTALLED: 2.0.4 (latest)

I'm noticing that my client.py is different from the one in the repo.

@robertwenquan
Copy link
Contributor

I just updated the repo. It's suggested to use the released pip.
One other thing is I noticed you are using python3. It's not currently supported yet.

@bkvaluemeal
Copy link
Author

Awesome, thanks! Even though python3 is not supported, I have yet to run into any issues. Although, I have only used the tag_images() function.

josh-tepper pushed a commit that referenced this issue Aug 11, 2023
Co-authored-by: Yvette Zhang <yvette@clarifai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants