Skip to content

Support file download. #46

@NeroBlackstone

Description

@NeroBlackstone

It seems OpenAPI only support application/json response, since at this code , response Content-Type set as application/json enforcement.

And I tried application/zip throws error

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _error(message::String, ps::JSON.Parser.MemoryParserState)
    @ JSON.Parser ~/.julia/packages/JSON/93Ea8/src/Parser.jl:140
  [3] parse_jsconstant(#unused#::JSON.Parser.ParserContext{Dict{String, Any}, Int64, true, nothing}, ps::JSON.Parser.MemoryParserState)
    @ JSON.Parser ~/.julia/packages/JSON/93Ea8/src/Parser.jl:193
  [4] parse_value(pc::JSON.Parser.ParserContext{Dict{String, Any}, Int64, true, nothing}, ps::JSON.Parser.MemoryParserState)
    @ JSON.Parser ~/.julia/packages/JSON/93Ea8/src/Parser.jl:170
  [5] parse(str::String; dicttype::Type, inttype::Type{Int64}, allownan::Bool, null::Nothing)
    @ JSON.Parser ~/.julia/packages/JSON/93Ea8/src/Parser.jl:450
  [6] parse
    @ ~/.julia/packages/JSON/93Ea8/src/Parser.jl:443 [inlined]
  [7] response
    @ ~/.julia/packages/OpenAPI/iZsIx/src/client.jl:330 [inlined]
  [8] response(#unused#::Type{Any}, resp::Downloads.Response, body::Vector{UInt8})
    @ OpenAPI.Clients ~/.julia/packages/OpenAPI/iZsIx/src/client.jl:325
  [9] exec(ctx::OpenAPI.Clients.Ctx, stream_to::Nothing)
    @ OpenAPI.Clients ~/.julia/packages/OpenAPI/iZsIx/src/client.jl:489
 [10] exec
    @ ~/.julia/packages/OpenAPI/iZsIx/src/client.jl:469 [inlined]
 [11] #datasets_download#61
    @ ~/Documents/github/Kaggle.jl/src/apis/api_KaggleApi.jl:490 [inlined]
 [12] datasets_download(_api::Main.Kaggle.APIClient.KaggleApi, owner_slug::String, dataset_slug::String)
    @ Main.Kaggle.APIClient ~/Documents/github/Kaggle.jl/src/apis/api_KaggleApi.jl:488
 [13] top-level scope
    @ ~/Documents/github/Kaggle.jl/src/Kaggle.jl:22

It parses the response body as json.

I want to make a PR to support file downloads. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions