Python module loader for http file
Project description
Python httpfile import loader
How to use?
- Create http file, such as
httpbin.http
### print my ip
//@name my-ip
GET https://httpbin.org/ip
- Add
httpfile-py
package inrequirements.txt
or other configuration file - Write your code:
import httpfile.loader
# noinspection PyUnresolvedReferences
import httpbin
if __name__ == '__main__':
r = httpbin.my_ip()
print(r.json())
Async support
If you want to use async feature, please add async_
prefix to request name, code as following:
import httpfile.loader
# noinspection PyUnresolvedReferences
import httpbin
import asyncio
async def my_ip():
r = await httpbin.async_my_ip()
print(r.json())
if __name__ == '__main__':
asyncio.run(my_ip())
Attention: don't forget to add asyncio
package!
Python HTTP Clients
- urllib3: https://urllib3.readthedocs.io/
- Requests: https://requests.readthedocs.io/
- aiohttp: https://docs.aiohttp.org/
- GRequests: https://github.com/spyoungtech/grequests
- HTTPX: https://www.python-httpx.org/
httpfile-py uses HTTPX as http client.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
httpfile-py-0.1.2.tar.gz
(9.4 kB
view details)
File details
Details for the file httpfile-py-0.1.2.tar.gz
.
File metadata
- Download URL: httpfile-py-0.1.2.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e6335a8b65eee2fee8dfdc02012bb481b1155f8a51b9455f70ae95e8a436036 |
|
MD5 | 1edb5abcb38938224f018a840d6615ae |
|
BLAKE2b-256 | 73dc07caab73a9eafc8975e8f06843616c4a77f34519559cc2b94cbb64d44458 |