asset query question/problem
pablomedrano10 opened this issue · 4 comments
Hello,
I am an intern for the summer at a company and they have asked me to write a python code to retrieve an asset's information given its ID but the examples given doesn't makes any sense.
It would be really helpful if anyone could provide any insight or a simple new example code to do that.
Thanks
I am getting this error when trying to create V1Meta:
AbstractBasicAuthHandler does not support the following scheme: 'Bearer'
You would have to paste your V1Meta creation code into this Issue before anyone can help you.
from v1pysdk import V1Meta
v1 = V1Meta(
instance_url = 'https://www9.v1host.com/*****',
username = '*****',
password = '*****'
)
user = v1.Member(20) # internal numeric ID
print (user.CreateDate, user.Name)```
I am just trying to run this example with my url, username and password and I am getting the following error:
File "/anaconda3/lib/python3.6/urllib/request.py", line 972, in http_error_auth_reqed
scheme)
ValueError: AbstractBasicAuthHandler does not support the following scheme: 'Bearer'```
I'm not familiar enough with the libraries myself, but some searching indicates this might be an uncaught authentication error. Try logging in to your Version One instance from a browser using the same credentials, click the "remember me" checkbox, and then reproduce the equivalent command from your browser (replacing the instanceName below):
https://www9.v1host.com/<instanceName>/rest-1.v1/Data/Member/20
The above is basically what the command deconstructs into. If running that command from the browser fails, then it indicates your administrator may have locked something down that doesn't allow you to access it. This could be a complete lockout on the API access, or it could just be a requirement that you use token based authentication. In theory it could also be locking your specific user from some data access.
As of the v1pysdk release 0.6.1, token authentication is now supported, so you might try that. You'll have to obtain an application token from the normal web interface of your instance, which will quickly tell you if you're allowed to access the API with your username in the first place.
Accessing members (userID 20 is Administrator by default) may also be blocked for your user. You might try getting the first Story instead:
https://www9.v1host.com/<instanceName>/rest-1.v1/Data/Story?sel=Name&page=1
equivalently:
from v1pysdk import V1Meta
v1 = V1Meta(
instance_url = ...
username = ...
password = ...
)
story = v1.Story.select('Name').page(size=1)
story.first()
print(story.Name)