Skip to content

Commit f7a7be5

Browse files
committed
final
1 parent 95046fe commit f7a7be5

File tree

6 files changed

+152
-3
lines changed

6 files changed

+152
-3
lines changed

.gitignore

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/
50 Bytes
Binary file not shown.

jan/settings.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
import os
14+
from dotenv import load_dotenv
1415

1516
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1617
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -69,6 +70,7 @@
6970

7071
WSGI_APPLICATION = 'jan.wsgi.application'
7172

73+
load_dotenv()
7274

7375
# Database
7476
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
89 Bytes
Binary file not shown.

newsapp/views.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
from bs4 import BeautifulSoup
66
import requests
77
import json
8-
newsapi = NewsApiClient(api_key ='950064c202904c90b89cb52b2c859a98')
8+
import os
9+
from dotenv import load_dotenv
10+
11+
12+
NEWSAPI_KEY = os.getenv('NEWSAPI_KEY')
13+
newsapi = NewsApiClient(api_key = NEWSAPI_KEY)
914
state_name_mapping = {}
10-
# Create your views here.
15+
1116
def index(request,keyw=None, coun='in'):
1217
if(keyw==None or keyw=="None"):
1318
top = newsapi.get_top_headlines(country=coun)
1419
else:
1520
top = newsapi.get_top_headlines(q=keyw,country=coun)
1621

1722
# sources = newsapi.get_sources()
18-
# print('\n\n\n',top)
1923

2024
l = top['articles']
2125
desc =[]

requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
requests==2.21.0
2+
Django==2.1.5
3+
newsapi_python==0.2.6
4+
beautifulsoup4==4.9.0
5+
newsapi==0.1.1

0 commit comments

Comments
 (0)