{{ statusMessage }}
Endpoint:
{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}
Method: POST
Content-Type: application/json
Request Body:
{{ selectedApi === 'pdf' ? '{ "html_content": "Your HTML string here" }' : '{ "html": "Your HTML string here" }' }}
import requests import json url = "{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}" payload = json.dumps({ "{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}": "<h1>Hello, World!</h1>" }) headers = { 'Content-Type': 'application/json' } response = requests.post(url, headers=headers, data=payload) with open('output.{{ selectedApi }}', 'wb') as f: f.write(response.content)
curl -X POST '{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}' \ -H 'Content-Type: application/json' \ -d '{"{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}": "<h1>Hello, World!</h1>"}' \ --output output.{{ selectedApi }}
fetch('{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ {{ selectedApi === 'pdf' ? 'html_content' : 'html' }}: '<h1>Hello, World!</h1>' }), }) .then(response => response.blob()) .then(blob => { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = 'output.{{ selectedApi }}'; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); }) .catch((error) => console.error('Error:', error));