question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

adding HTTPie group and argument from httpie-edgegrid

See original GitHub issue

Hi,

I am working on the plugin httpie-edgegrid to add a --config parameter to httpie. Thus the user would be able to pass the location of the credentials file (original request here).

Thus I have added the following code:

import httpie.cli.definition as httpie_cli_definition

edgegrid_group = httpie_cli_definition.options.add_group("EdgeGrid")
edgegrid_group.add_argument(
    "--config",
    action='edgerc',
    default='~/.edgerc',
    help='.edgerc credentials file (defaults to ~/.edgerc)'
)
httpie_cli_definition.options.finalize()
httpie_cli_definition.parser = httpie_cli_definition.to_argparse(httpie_cli_definition.options)

But when I am issuing a simple httpie command, the parameter does not get recognized:

$ http --auth-type edgegrid -a afadencloud-example-01: --config ./test/sample_edgerc: :/contracts
usage:
    http [METHOD] URL [REQUEST_ITEM ...]

error:
    unrecognized arguments: --config

for more information:
    run 'http --help' or visit https://httpie.io/docs/cli

Httpie-edgegrid seems installed correctly:

$ httpie plugins list 
httpie-edgegrid (1.0.2)
  httpie_oauth1 (httpie.plugins.auth.v1)

From the documentation and looking at other httpie plugins, I have not seen even if what I am trying is feasible. Could you please help me out? Thanks 👍

Regards,

Roberto

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
robertolopezlopezcommented, Mar 31, 2022

Hi @isidentical ,

That’s what I would call a great pythonic display 😃

It kind of works. The only problem I can see is that argparse._StoreAction is an internal class, so importing from httpie-edgegrid is not an easy task. What I have done is copying its __init__() implementation to my EdgeGridSetterAction, and then make it extend argparse.Action directly.

This bypass seems to be working, but I need to do more testing.

Thanks once again. I am closing this ticket again, and I hope this time for good 😉

Roberto

1reaction
robertolopezlopezcommented, Mar 30, 2022

Wow @isidentical , I would not have come up with such idea easily. Kudos for you 👍

Now it works locally. Hopefully we will release the new version soon - with this and other changes.

Regards,

Roberto

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTPie 3.2.1 (latest) docs
HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible.
Read more >
akamai/httpie-edgegrid - GitHub
Plugin for httpie to allow edge grid authentication for Akamai - GitHub ... Once you have the credentials set up, here is an...
Read more >
HTTPie prompts for password - Stack Overflow
HTTPie prompts for password ... I am using HTTPie to make edgegrid authenticated calls to a set of REST APIs, but httpie always...
Read more >
HTTPie - Akamai TechDocs
HTTPie is a simple command-line client you can use to make Akamai API ... Once you've set up EdgeGrid authentication, you can make...
Read more >
Exploring Akamai OPEN APIs from the command line using ...
This will build and install the HTTPie http command line tool to /usr/local/bin and enable the edgegrid authorization module. Verify that the http...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found