Skip to main content

ruff status workflow test status workflow build

Downloads Downloads Downloads

PhantomBrowser is typed Python wrapper for phantomjscloud.com api with optimize magic rendering and support asynchronous.

Installation

pip install phantombrowser

Example

render html:

from PhantomBrowser import Browser


browser = Browser()
response = browser.get("https://example.com")
print(response.text)
browser.close()

render plain text:

from PhantomBrowser import Browser


browser = Browser()
response = browser.get("https://example.com", render="plainText")
print(response.text)
browser.close()

render image:

from PhantomBrowser import Browser


browser = Browser()
response = browser.get("https://example.com", render="png")
browser.saveAs("example.png", response.content)
browser.close()

render PDF:

from PhantomBrowser import Browser


browser = Browser()
response = browser.get("https://example.com", render="pdf")
browser.saveAs("example.pdf", response.content)
browser.close()

the other method like browser.post(), browser.put(), browser.patch(), browser.option() and browser.delete() also supported.

You can also use the API key by setting the environment variable PHANTOMJSCLOUD.COM_APIKEY or directly in the class

from PhantomBrowser import Browser


browser = Browser("Your API Key")

Asynchronous Example

from PhantomBrowser import AsyncBrowser
import asyncio


async def main():
    browser = AsyncBrowser()
    response = await browser.get("https://example.com")
    print(await response.text())
    await browser.close()

if __name__ == '__main__':
    asyncio.run(main())

License

MIT

Metadata

Release files for phantombrowser 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phantombrowser 0.0.4
File Size Uploaded Provenance
phantombrowser-0.0.4.tar.gz 7.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for phantombrowser 0.0.4
File Interpreter ABI Platform
phantombrowser-0.0.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.2 kB

Release files / phantombrowser-0.0.4.tar.gz

Download URL phantombrowser-0.0.4.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
93d1df3c1efd81af85ce69ba0b960bc535db1597e7eec18f2b4b5d368b2e2e88
BLAKE2b-256 checksum
How to use checksums
e34becce8518ea1584e6c201022630da7af7334f9574608586bc3b3bba710d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / phantombrowser-0.0.4-py2.py3-none-any.whl

Download URL phantombrowser-0.0.4-py2.py3-none-any.whl
Size 9.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
58257eb9cdfd081ca1d834579adf2dd1728fa164e8df1fe201213adcb9cdacb8
BLAKE2b-256 checksum
How to use checksums
24c09dff22b6fb001e6594929b6e5fd3b610413b9060976c0934148c68db2e06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Security for phantombrowser 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page