Such an error occurred: in the code, you need to load the get data with a method and parse the response (the data comes in the form of xml), which I actually did. enter image description here

And everything went smoothly - it turned out a valid ElementTree object. enter image description here

But one has only to call the text property from the request - everything is immediately frayed and the infa cannot be parsed. enter image description here

enter image description here

code :

import requests as re import xml.etree.ElementTree as ET USER = "XXX" PASSWD = "XXX" BASE_COPERNICUS_URL = "https://scihub.copernicus.eu/s3/odata/v1/" try: http_resp = re.get(metadata_url, auth=(self.USER, self.PASSWD), stream=True) print(http_resp.text) http_resp.raw.decode_content = True xml_tree = ET.parse(http_resp.raw) except Exception as error: print("SMTH goes bad") print(error.__str__()) 
  • 7
    Please provide the code with text, not screenshots ... - Bogdan
  • Can you give me the contents of the metadata_url variable? - MaxU
  • In your place, I did not publish passwords so openly (= - hedgehogues
  • Please replace ALL images with text. - hedgehogues
  • Why raw ? Do you want to disassemble gzip-content content, transfer chunks? - Alex Yu

1 answer 1

If you execute the following code, replacing USER and PASSWD with valid values, then everything will work correctly:

 import requests USER = "XXX" PASSWD = "XXX" BASE_COPERNICUS_URL = "https://scihub.copernicus.eu/s3/odata/v1/" try: http_resp = requests.get(BASE_COPERNICUS_URL, auth=(USER, PASSWD), stream=True) print(http_resp.text) except Exception as error: print("SMTH goes bad") print(error.__str__()) 
  • Yes, until I start the xml parsing, everything is going fine - Sanek Tarasov
  • @ SanekTarasov What is the ET package? Give the full code - hedgehogues