Skip to main content

Python module loader for http file

Project description

Python httpfile import loader

import httpfile in Python

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 in requirements.txt or other configuration file
  • Write your code:
import httpfile.loader
# noinspection PyUnresolvedReferences
import httpbin
from httpx import Response

if __name__ == '__main__':
    r: Response = 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
from httpx import Response


async def my_ip():
    r: Response = 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

httpfile-py uses HTTPX as http client.

References

Project details


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.3.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file httpfile-py-0.1.3.tar.gz.

File metadata

  • Download URL: httpfile-py-0.1.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for httpfile-py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e5cc553f16680bdbfb3c5d0de2c27a7becbe0b6b593cbdd44c74aa8f75fd5da5
MD5 d16642bd9dddb3167af6c4ff899647d2
BLAKE2b-256 f5f4deb79223f0e9b7a6782532ce7ee99af20b96bdd95cf4fb0c1373d1409133

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page