Извлекать ежедневный фид данных электронной почты - PullRequest
0 голосов
/ 06 февраля 2019

Я получаю ежедневное электронное письмо, содержащее канал данных.Письмо содержит почтовый файл, который содержит текстовый файл, который содержит данные XML.Как я могу автоматизировать извлечение этих данных с помощью Python?В настоящее время я создал специальную программу, которая извлекает данные из XML-форматирования, но мне нужно вручную сохранить текстовый файл как XML-файл, а затем запустить модуль.Есть ли способ автоматизировать этот процесс?

Пример текстового файла, содержащего данные XML

<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:c="http://base.google.com/cns/1.0" xmlns:g="http://base.google.com/ns/1.0">
<title>Recipes</title>
<link type="text/html" rel="alternate" href="https://www.recipes.com/recipe"/>
<updated>2019-02-05T11:30:51Z</updated>
<author>
<name>Recipes</name>
</author>
<id>https://www.recipes.com/recipe</id>
<entry>
<title>Salt &amp; Vinegar French Fries</title>
<summary>These crispy fries derive their bright, lively flavor from a sprinkling of malt vinegar sea salt, a British-inspired blend of tangy malt vinegar powder and sea salt.</summary>
<id>salt-vinegar-fries</id>
<g:image_link>https://www.recipes.com/wsimgs/ab/images/dp/recipe/201851/0009/img88t.jpg</g:image_link>
<link href="https://www.recipes.com/recipe/salt-vinegar-fries.html"/>
<g:main_ingredient>Vinegar, Potato</g:main_ingredient>
<g:meal_type>Side Dish</g:meal_type>
<g:preparation_time>20</g:preparation_time>
<g:servings>8</g:servings>
<g:cooking_time>10</g:cooking_time>
<g:course>Side Dishes</g:course>
<g:cuisine>American</g:cuisine>
</entry>
<entry>
<title>Spice-Roasted Salmon with Cucumber Salad (Tandoori Spice)</title>
<summary>Combining a dozen seasonings, including chili, paprika, cumin and fragrant menthi leaves, our Indian-inspired tandoori spice lends complex flavor to broiled salmon fillets. A cucumber salad provides a refreshing contrast.</summary>
<id>spice-salmon-cucumber-salad</id>
<g:image_link>https://www.recipes.com/wsimgs/ab/images/dp/recipe/201851/0009/img91t.jpg</g:image_link>
<link href="https://www.recipes.com/recipe/spice-salmon-cucumber-salad.html"/>
<g:main_ingredient>Meal Type, Salmon, Cucumber</g:main_ingredient>
<g:preparation_time>15</g:preparation_time>
<g:servings>4</g:servings>
<g:cooking_time>10</g:cooking_time>
<g:course>Side Dishes</g:course>
<g:cuisine>Indian</g:cuisine>
</entry>
<entry>
<title>Cranberry-Pear Chutney</title>
<summary>Aromatic blue-black juniper berries, which come from a tree in the cypress family, impart a spicy evergreen flavor to this chutney, balanced by floral and woodsy notes. The chutney pairs well with most types of cheese, young or aged. Cow's milk and aged sheep's milk cheeses are good choices, but this tangy chutney is also superb served atop fresh ricotta or soft goat cheese.</summary>
<id>cranberry-pear-chutney</id>
<g:image_link>https://www.recipes.com/wsimgs/ab/images/dp/recipe/201851/0010/img1t.jpg</g:image_link>
<link href="https://www.recipes.com/recipe/cranberry-pear-chutney.html"/>
<g:main_ingredient>Pear, Juniper Berry, Cranberry, Meal Type</g:main_ingredient>
<g:preparation_time>15</g:preparation_time>
<g:servings>9</g:servings>
<g:cooking_time>30</g:cooking_time>
<g:course>Side Dishes</g:course>
<g:cuisine>American-New England</g:cuisine>
</entry>
<entry>
...