{ "cells": [ { "cell_type": "markdown", "id": "4baa72c7-b196-4658-b8bb-b8aaf73fd631", "metadata": {}, "source": [ "https://hub.xpub.nl/soupboat/~mirischoeb/api/" ] }, { "cell_type": "code", "execution_count": 2, "id": "45f690d6-66c4-4cb9-ad9b-cbac2def7acf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " * Serving Flask app '__main__' (lazy loading)\n", " * Environment: production\n", "\u001b[31m WARNING: This is a development server. Do not use it in a production deployment.\u001b[0m\n", "\u001b[2m Use a production WSGI server instead.\u001b[0m\n", " * Debug mode: off\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " * Running on http://127.0.0.1:9089/ (Press CTRL+C to quit)\n" ] } ], "source": [ "from flask import Flask, request, json\n", "from weasyprint import HTML, CSS\n", "\n", "app = Flask(__name__)\n", "\n", "\n", "def swap(text, target, replacement):\n", " result= text.replace(target, replacement)\n", " return result\n", "\n", "\n", "\n", "\n", "@app.route(f\"/~mirischoeb/api/\")\n", "def replace():\n", " \n", " text=request.values.get('text', '')\n", " target = request.values.get('target', '')\n", " replacement = request.values.get('replacement', '')\n", " title = f\"
{swap(text, target, replacement)}
\"\n", " contents= title + txt_result\n", " \n", " with open(\"db.txt\", \"a\") as db:\n", " db.write(contents+ \" \\n\")\n", " \n", " with open (\"archive.html\", \"a\") as output:\n", " print(contents, file=output)\n", " HTML(filename=\"archive.html\").write_pdf('./replace_booklet.pdf')\n", " \n", " return f\"\"\"\n", " \n", " \n", "\n", " \n", " \n", " \n", "\", file=output)\n", " print (sent + \" \", file=output)\n", " print (\"\", file=output)\n", "HTML(filename=\"test.html\").write_pdf('./test.pdf')" ] }, { "cell_type": "code", "execution_count": 5, "id": "db104bf9-1283-4ea9-ae6b-2fa361a5de6b", "metadata": {}, "outputs": [], "source": [ "\n", " \n", "page= open(\"archive.html\").read()" ] }, { "cell_type": "code", "execution_count": 6, "id": "db85d308-10f7-4b95-9936-60638bc2e9fe", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"
this m🥓rning I tried t🥓 print a pdf directly fr🥓m this f🥓r , let's see if it w🥓rks n🥓w
\\nwhat happens if nOOOOOw i write anOOOOOther text??
\\nnO*O*O*O*O*O*O*Oice
\\nnO*O*O*O*O*O*O*Oice
\\nnO*O*O*O*O*O*O*Oice againnnnn
\\n\\n\\ntext
\\nThehe moments’ repose\\nAwoke eyes of ice\\nIn vision froze, froze\\nThehe melting world\\nAll is around\\nBut within is barren, is barren\\n\\nDrying thehe water\\nAnchor me in ice\\nMirror of thehe reaper\\nThehe arrow of my eyes\\n\\nSlow, beating pendulum\\nDon’t measure time\\nI’ll sink thehe heheavens\\nWhile reaching for thehe dawn\\n\\nSeven eyes sewn open, bestow\\nAs Above, So Below\\nWater mirrors and thehe stillness grows…\\n\\nInto Seven more\\n(Unseeing)\\n\\nThehe bondage throne\\n\\nThehe waves that shore\\nTwo thirsty hands\\nSewing a needle of blood\\nTo bind me\\nTo bind me\\nWeaving thehe ocean\\n\\nThrough which I flood\\nThehe heheaven of blood\\nTo bind me\\nI’m bound to\\nWaves\\nThehe waves of no shore\\n\\nFloods that sleeve\\nThehe reach of thehe drought\\nTo bleed evermore\\nEmpty me\\nEmpty me\\nAsh of thehe ocean\\n(Sewing)\\nTo bind me\\n(Sewing needle of drought)\\nTo bind me\\n(Weaving)\\nWeaving thehe ocean\\n(Weaving pendulum)\\n\\nHanging, weaving thehe ground\\nA breathless fabric of floating ashehes\\nTied, and thehen rewound\\n\\n[Part 2: Words of thehe Dead]\\nReigned\\n(Weaved in thehe needle)\\nThehe cycle turns around\\nAir, burnt to ashehen mountains\\n(Weaving thehe ground)\\nSwimming underground\\n\\nPendulum\\nSilent gavel\\n(Of time)\\nIt’s burning in thehe sky\\n\\nBe not whehere you lay\\nLest thehe bond be broken\\nVanish whehere you stay\\nTimeless in thehe well\\nLest thehe song is spoken\\nOver for thehe sell\\n\\nEye of thehe cold\\nWill scald in thehe fold\\nHigheher than low\\n\\nDripping from thehe scene\\nLest thehe scalding ocean\\nIs drowning all thehe trees\\nTime to fall this cell\\nKnow thehe name of harrowed\\nWith it you’ll do well\\n\\nThehe crane that only felt was never seen as spoken\\nIts vanishehed from my self\\nThehe tame you would arise\\nFormulate thehe harrowed\\nVanish in thehe eye\\nVanish in thehe eyes\\nVanish from thehe skies\\n\\nThehe stain that only sees\\nCrawl like rain\\nIs only led through harrowed\\nFor disdain\\nWhehen practiced at thehe dream\\nWhehen nothing left to see\\nNaught to feign\\nCall thehe name upon this floor\\nNor to drain\\nKnow that it is more\\nAnd opened in thehe shallows\\nNone for sane\\nWhehen nothing could be more\\nBut for more\\nWhehen nothing could be more\\nBurn thehe core\\nYou see thehe final shore from before\\nBleed beyond thehe poor\\nLast of lore\\nDrip upon thehe floor\\nSeen as more\\nVanish for thehe more\\nTold it well\\nCalled beyond thehe well\\nThehen tore thehe shehell\\nLed beyond thehe chill\\nWhehen nothing heheld\\nStone thehe moon as well\\nBut something fell\\nFor which you could have found\\n\\n[Part 3]\\nFloat thehe moon as well…\\n\\nFloat thehe moon as well…\\n\\nAll who strayed beyond thehe shadows have nothing to disdain\\nAll that soared away from reason were heheld aloft in sway\\nAll that’s widening thehe narrows will crumble to decay\\n\\nLie of thehe sold\\n(Lie of thehe sold)\\nWould warm in thehe cold\\nDesire will hold\\n\\nIf thehe motion\\nLied and light had froze\\nMight of thehe fever\\nHold my eyes to know\\n\\nDry thehe waves\\nAnchor ice\\nMirror reaper\\nArrowed eyes\\n\\nAn ice of pieces\\nOf what was once thehere\\nThehe skin of being\\nFlayed as though\\nThehe air\\n\\nDry thehe land\\nAnchor sand\\nMirror reaper\\nGallows stand\\nSlow thehe heheart\\nStill thehe tide\\nSink thehe heheavens\\nFrom thehe sky\\n\\nAll that laid upon this hallowed yet crumbling domain\\nAll who strayed beyond thehe shadows have nothing to disdain\\n\\nThis cycle thus froze\\nWhehen seeking a repose\\nThehe thawing of peace\\nDrips backward to thehe freeze\\nNow motion lies still\\nWith naught left for thehe kill\\nA fever long boiled\\nAnd venom to recoil\\n\\nThehe pendulum slows\\nThehen stilled under thehe cold\\nIn absence hehe flies\\nIn presence we will writhehe
\\n\\n\\n\\nI have one answer for both of you. \\n\\nPrime Minister Mitsotakis, when at last will you stop lying, lying about pushbacks, lying about what is happening with the refugees in Greece? \\n\\nPlease don’t insult mine and neither the intelligence of all the journalists in the world. \\n\\nThere has been overwhelming evidence and you keep denying and lying. \\n\\nThis is like narcissistic abuse. \\n\\nWhy are you not honest? \\n\\nWhy don’t you say Brussels left us alone? \\n\\nWe waited for six years. Nobody did anything. \\n\\nWe need to relocate. \\n\\nThey don’t do it. \\n\\nNow, I have my say and yes I do cruel, barbarian pushbacks. \\n\\nWhy did you stop knocking on Brussels’ door for relocation?\\n\\n\\nFor you Mr. Rutte, what according to you are the sanctions that should be imposed on Greece and maybe on Holland for accepting this violation of human rights that Holland is co-responsible of also? \\n\\nMany, many municipalities in Holland want to take many refugees from Greece, like many minor unaccompanied children.\\n\\nThey are many to accept them, but this prime minister opposes to that, so maybe you could find an understanding and the Dutch municipality who are so ready to unburden Greece can actually take in refugees from Greece, which his [the Greek PM’s] government opposes.\\n\\n\\n\\n\\nKyriakos Mitsotakis, greek PM\\n\\nI understand that in the Netherlands you have a culture of asking direct answers to politicians, which I very much respect. \\n\\nWhat I will not accept is that, in this office, you will insult me, or the Greek people, with accusations and expressions that are not supported by material facts when this country has been dealing with a migration crisis of unprecedented intensity, has been saving hundreds, if not thousands of people at sea. \\n\\nWe just rescued 250 people in danger of drowning south of Crete, we are doing this every single day rescuing people at sea, while, at the same time, we are intercepting boats that come from Turkey, as we have the right to do in accordance with European regulations and waiting for the Turkish Coast Guard to come and pick them up and return them to Turkey. \\n\\nSo, rather than putting the blame on Greece, you should put the blame on those who have been instrumentalizing migration systematically pushing people in(to a) desperate situation from a safe country, because I need to remind you that people who are in Turkey are not in danger, their life is not in danger and you should put the blame on others and not us. \\n\\nWe have a tough, but fair, policy on migration, we have processed and given the right to protection in Greece to 50,000 people, including tens of thousands of Afghans, in accordance…\\n\\nAllow me. Have you visited the new camps on our islands? Have you been to Samos? … No listen to me, you have not been to Samos… No you have not been...\\n\\nPlease…Look, you will not come into this building and insult me. \\n\\nAm I very clear on this? \\n\\nI am answering now and you will not interrupt me, in the same way that I listened to you very carefully. \\n\\nIf you go to Samos, you will find an impeccable camp, with impeccable conditions, funded by EU money, with clean facilities, with playgrounds for…the children to play, no comparison to what we had in the past. \\n\\nThis is our policy, we will stand by it, and I will not accept anyone pointing the finger to [sic] this government and accusing it of inhumane behavior.\\n\\n\\n\\n\\n\\nMark Rutte, dutch PM\\nI am absolutely convinced that this prime minister and this government is applying the highest standards and the fact that they have immediately launched an investigation on the issue of the pushbacks is testimony of that.\\n\\nI will now bo back on the situation of 2015 and 2016 when we had many people dying on the Aegean Sea trying to get from Turkey into Greece and then to Germany, Sweeden, the Netherlands etc. And I am happy that Germany and we -were holding at that time the rotating presidency of the EU- were able to negotiate the EU and Turkey aggreement.\\n\\nBy which indeed Turkey is a safe country for people to stay.\\n\\nAnd Turkey at this moment is hosting over 3 million Syrian refugees in the South of Turkey in camps but also in the local communities.\\n\\nWhat this country is trying to do is to defend the outer borders of the European Union. \\n\\nIt is a lot of tasks that countries have who are lying on the outside like Italy, Spain, Hungary, Slovenia, but also Poland and Greece, and there is an extremely difficult situation.\\n\\nWhat I don’t want again is for people to take boats that are not fully equipped to pass the Mediterranean or to pass the Aegean Sea, to die in those circumstances. \\n\\nI want them to stay there [in Turkey], to be safe, and then we are willing as European Union to take a fair share of people from Africa, from Turkey – refugees, in line with the plans devised in 2015 [the EU-Turkey Statement on refugees-migrants] and 2016.\\n\\nSo this is my answer and I wish that your answer has been answered
\\n\"" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "page" ] }, { "cell_type": "code", "execution_count": null, "id": "858662cb-43f0-48c4-9221-80faa22ece3c", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "642efc3f-0b66-4b94-b850-576f8d0f9dc1", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 5 }