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

Some Help please object inside array #1494

Closed
kenkit opened this issue Feb 23, 2019 · 6 comments
Closed

Some Help please object inside array #1494

kenkit opened this issue Feb 23, 2019 · 6 comments
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@kenkit
Copy link

kenkit commented Feb 23, 2019

Sorry I can't understand how I can do this.

My code is like below

              out_message["params"]={
                    {url}, 
                    {
                      {"dir",save_loc},
                      {"out",file_name }, 
                      {"continue", true},
                      {"split", connections}, 
                      {"max-connection-per-server", connections},
                      {"user-agent", user_agent},
                    } 
                      
                };

I want to add

header object with Cookie right after user-agent array which is an object.
I've been using https://github.com/meoow/aria2rpc/blob/0c8e2ffbbea496415d418238e94d8c118a5c09ed/aria2rpc.py#L54
as my guide.
Thanks in advance.

@kenkit
Copy link
Author

kenkit commented Feb 23, 2019

If you see any mistake feel free to point them out.

@kenkit
Copy link
Author

kenkit commented Feb 27, 2019

Also another question.
let's say I have

json["huge_array"]={   {"varx","1234"}, };

how can we just do it like this

for(int i=0;i<10;i++)
json["huge_array"][i]= {"varx","1234"};

@kenkit kenkit closed this as completed Feb 27, 2019
@kenkit kenkit reopened this Feb 28, 2019
@kenkit
Copy link
Author

kenkit commented Feb 28, 2019

I had made a mistake, sorry about that

@kenkit
Copy link
Author

kenkit commented Mar 2, 2019

This is how it should look like

{
    "jsonrpc": "2.0",
    "id": "meoow/aria2rpc",
    "method": "aria2.addUri",
    "params": [
        "http:google.com",
        {
            "continue": "true",
            "max-connection-per-server": 15,
            "split": 15,
            "min-split-size": "10M",
            "user-agent": "Mozilla/5.0 (X11; Linux; rv:5.0) Gecko/5.0 Firefox/5.0",
            "header": [
                "Cookie: a cookie over here"
            ]
        }
    ]
}

How do I add the header ?

@kenkit
Copy link
Author

kenkit commented Mar 2, 2019

Solved with

                        {"dir",save_loc},
                        {"out",file_name }, 
                        {"continue", true},
                        {"split", connections}, 
                        {"max-connection-per-server", connections},
                        {"user-agent", user_agent},
                        {"header",{"Cookie: "+cookies}}

@kenkit kenkit closed this as completed Mar 2, 2019
@kenkit
Copy link
Author

kenkit commented Mar 2, 2019

For the other question. I fixed it using pushback(json::array())

@nlohmann nlohmann added kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation labels Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants