Skip to content
Open

PR #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions PR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
S C:\Users\gisel\desktop\challenge_1> git add challenge1.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elimine este archivo

warning: in the working copy of 'challenge1.py', LF will be replaced by CRLF the next time Git touches it
PS C:\Users\gisel\desktop\challenge_1> git status
On branch cambios_en_read_me
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: challenge1.py

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md

PS C:\Users\gisel\desktop\challenge_1> git commit m- "cambios en readme y agregar archivo en nueva branch"
error: pathspec 'm-' did not match any file(s) known to git
error: pathspec 'cambios en readme y agregar archivo en nueva branch' did not match any file(s) known to git
PS C:\Users\gisel\desktop\challenge_1> git commit -m "cambios en readme y archivo nuevo"
[cambios_en_read_me 80695c0] cambios en readme y archivo nuevo
1 file changed, 20 insertions(+)
create mode 100644 challenge1.py
PS C:\Users\gisel\desktop\challenge_1> git push origin cambios_en_read_me
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 536 bytes | 268.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/mundo-python/challenge_1
22acf23..80695c0 cambios_en_read_me -> cambios_en_read_me
PS C:\Users\gisel\desktop\challenge_1>
39 changes: 39 additions & 0 deletions ch1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import requests
import feedparser
import json

url = f'https://www.theverge.com/rss/index.xml'
r= requests.get(url)

if r.status_code != 200:
print(f"error with status code {r.status_code}")

#los primeros 10 items

feed = feedparser.parse(url)

items = feed.entries[:10]

for i, item in enumerate(items, start=1):
title = item.title
pub_date = item.published
link = item.link

print(f"{i}. Title: {title}")
print(f"Date: {pub_date}")
print(f"Link: {link}")

#Guardar un archivo JSON
data = []
for item in items:
lista = {
"title": item.title,
"published": item.published,
"link": item.link
}
data.append(lista)


with open("10items.json", "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)

20 changes: 0 additions & 20 deletions challenge1.py

This file was deleted.