Skip to content

RaThorat/data-repositories-download

Repository files navigation

data-repositories-download

Importing repositories from Re3data

This code is used to import repository information from the website Re3data. It begins by sending a request to the Re3data API and saving the response as an xml file. The code then imports the ElementTree module and uses it to parse the xml file, getting the root tag and printing it out along with its memory location. The code also prints out the attributes of the first tag from the parent and the text contained within the first subtag of the 5th tag.

The code then creates an empty list and iterates over each 'name' tag in the xml file, appending the text contained within each tag to the list. Finally, the code iterates over each 'name' tag again and prints out the text contained within each tag. The names of the repositories can then be copied and pasted into an Excel file, which should be named 'Repositories.xlsx'.

Chat_GPT's response to the original file

The code you've provided appears to be correctly importing repository information from the website Re3data, sending an API request to retrieve the data, and then parsing the resulting XML file to extract the repository names.

There are a couple of things that can be changed to make the code cleaner and more readable.

1.The first response variable is not used anywhere in the code, and it can be removed.

  1. The second block of code which saves the xml file is redundant as the same file is being written twice.

  2. You could consider using a library such as pandas to read the xml and make it more readable.

  3. The commented out line #print(Repo_list) will not have any effect on the output, if you want to see the list, you can just print Repo_list

  4. Instead of copying and pasting the repository names to excel, you can use the pandas library to write the list to excel.

Releases

No releases published

Packages

No packages published

Languages