Я хочу получить html-контент, загруженный из URL в iframe, и хочу отобразить его в другом iframe в Django? - PullRequest
0 голосов
/ 28 декабря 2018
 <div class="box">
                <iframe src="https://api.cloudconvert.com/convert/" enctype="multipart/form-data" frameborder="2" name="frame1" scrolling="yes" width="600" height="712" align="right" > </iframe> 
                <form method="POST" action="https://api.cloudconvert.com/convert/" enctype="multipart/form-data" target="frame1">

                <input type="file" name="file">
                <input type="hidden" name="apikey" value="EwzmwYg9LNggAcJdCfg0i5kPQqVSZPMnsYZw1KczeWJTuBlsT0uceQmKBllQppoA">
                <input type="hidden" name="inputformat" value="pdf">
                <input type="hidden" name="outputformat" value="html">
                <input type="hidden" name="input" value="upload">
                <input type="hidden" name="timeout" value="10">
                <input type="hidden" name="wait" value="true">
                <input type="hidden" name="download" value="inline">
                <input type="hidden" name="save" value="true">
                <input type="submit" value="Convert!">
            </form>

        </div>

Выше приведен мой HTML-код для загрузки содержимого моего iframe.

def pdf_html(request):
    tag = []
    try:
        html = open("/home/sevenbits/pro/project/myproject/templates/pdf_html/iframe.html")
    except HTTPError as e:
        print(e)
    except URLError:
        print("Server down or incorrect domain")
    else:
        res = BeautifulSoup(html.read(), "html5lib")
        tag = res.find('iframe')
        src = tag['src','enctype']
         #URl of iframe ready for scraping
    return render(request,'pdf_html/iframe.html')

Это мой вид для отображения содержимого HTML-страницы.

Я хочупросто взять код html-страницы, загруженной в iframe, и отобразить его в моем другом iframe, и я использую библиотеку beautifulsoup.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...