You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
799 B
Python

import requests
import codecs
print("#"*5 + " XML")
resp = requests.post('https://europass.cedefop.europa.eu/rest/v1/document/extraction',
headers={ "Content-Type": "application/pdf"},
data= open("cv.pdf", "rb")
)
print resp
print resp.text
with codecs.open("cv.xml", "w", encoding="utf-8") as f:
f.write(resp.text)
print("### File written")
print("#"*5 + " JSON")
resp = requests.post('https://europass.cedefop.europa.eu/rest/v1/document/to/json',
headers={ "Content-Type": "application/xml"},
data= open("cv.xml", "rb")
)
print resp
print resp.text
with codecs.open("cv.json", "w", encoding="utf-8") as f:
f.write(resp.text)
print("### File written")