Python API
See original GitHub issueHTTP Prompt* heavily relies on httpie.core.main()
function to send actual HTTP requests. Some HTTP Prompt’s features, like setting incoming cookies, require us to access the response object (requests.Response
, to be more specific) in Python, but httpie.core.main()
doesn’t provide such an API. So HTTP Prompt “hacks” HTTPie with sys.settrace()
to get the response object returned by httpie.core.get_response()
, as the following code shows:
https://github.com/eliangcs/http-prompt/blob/cbd092299/http_prompt/execution.py#L430
I wonder if HTTPie could offer an API for developers to access the internal response object easier.
* For those who haven’t already known: HTTP Prompt is a wrapper that provides an interactive interface of HTTPie.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Python API Tutorial: Getting Started with APIs - Dataquest
An API, or Application Programming Interface, is a server that you can use to retrieve and send data to using code. APIs are...
Read more >Python/C API Reference Manual — Python 3.11.1 ...
This manual documents the API used by C and C++ programmers who want to write extension modules or embed Python. It is a...
Read more >Python & APIs: A Winning Combo for Reading Public Data
API stands for application programming interface. In essence, an API acts as a communication layer, or as the name says, an interface, that...
Read more >How to use an API with Python (Beginner's Guide) - RapidAPI
An API (Application Programming Interface) is a set of rules that are shared by a particular service. These rules determine in which format...
Read more >Python API Development - Comprehensive Course ... - YouTube
Learn Python API development in one of the most comprehensive courses ever on the topic. You will build a full-fledged API in Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
HTTPony touches very little of HTTPie’s APIs. It’s limited to:
The core of what is done is passing a
requests.models.Request
tostreams.build_output_stream
and callingstreams.write_stream
. All that happens in https://github.com/mblayman/httpony/blob/master/httpony/application.py.Yes, it makes sense — I’ll look into this.
main()
could return both exit status code and the final HTTP response. And maybe the parse args as well would be useful to return as well.