Giter Club home page Giter Club logo

Comments (9)

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

Hi! This is not the intended way to use the client. Sorry, I should remove that documentation.
Take a look here, there is an example snippet to upload a file. Namely:

import cheshire_cat_api as ccat
from cheshire_cat_api.models.body_upload_url import BodyUploadUrl

# A config is necessary to set up base parameters like
# URL, port, user_id, etc.
config = ccat.Config(user_id="my_user_42")

# Connect to the API
cat_client = ccat.CatClient(
    config=config
)

# Please note that interacting with the RabbitHole to upload
# a URL requires structuring the body like this

body_upload_url = BodyUploadUrl(
    url="https://cheshire-cat-ai.github.io/docs/conceptual/cheshire_cat/rabbit_hole/"
)

# then you can make the request as follows
response = cat_client.rabbit_hole.upload_url(body_upload_url)

from api-client-py.

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

I realized I pasted the example to upload a url, the code for a file is

response = cat_client.rabbit_hole.upload_file(file_path)

from api-client-py.

DavideRichini avatar DavideRichini commented on August 25, 2024

Thank you for the response. It makes sense that it is not the intended behaviour but I was confused by the documentation.
Would it be ok for me to send a pr with fixes to the documentation of the rabbir hole api? Because the current example for the upload_file method deosn't even run.

from api-client-py.

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

Which error do you get?
If you want to make a pr to fix the documentation you linked, that should be removed completely since it is autogenerated.
It would be nice, but demanding to have a nice docs like the one of the cat with mkdocs and hosted on github pages.
If you feel like setting this up would be a huge contribution

from api-client-py.

DavideRichini avatar DavideRichini commented on August 25, 2024

I get this error
Traceback (most recent call last): File "D:\stregatto\a.txt", line 9, in <module> configuration = cheshire_cat_api.Configuration( AttributeError: module 'cheshire_cat_api' has no attribute 'Configuration'. Did you mean: 'configuration'?

It is caused because the class is Configuration while the file is all lowercase so you need to import it with
from cheshire_cat_api.configuration import Configuration

If I want to contribute to the docs the correct way should be by contributing to this repo, right?

from api-client-py.

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

Please, take a look at the whole code in the snippet I shared before. This is how you import the config

import cheshire_cat_api as ccat
from cheshire_cat_api.models.body_upload_url import BodyUploadUrl

# A config is necessary to set up base parameters like
# URL, port, user_id, etc.
config = ccat.Config(user_id="my_user_42")

from api-client-py.

DavideRichini avatar DavideRichini commented on August 25, 2024

Your code snipped does work. What I was saying is that the example code for the upload_file method in the documentation does not work because of a wrong import.

from api-client-py.

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

Yes, that documentation is autogenerated and should be removed

from api-client-py.

nicola-corbellini avatar nicola-corbellini commented on August 25, 2024

If the bug is solved I'm closing the issue, feel free to open it again if you have any other trouble

from api-client-py.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.