Skip to content

Commit 91dfea9

Browse files
committed
Add github workflow file
1 parent 9e62b6f commit 91dfea9

14 files changed

Lines changed: 49 additions & 9 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: '3.8'
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine pytest
25+
- name: Build and publish
26+
env:
27+
PYTEST_TOKEN: ${{ secrets.PYTEST_NEWSDATA_API }}
28+
TWINE_USERNAME: __token__
29+
TWINE_PASSWORD: ${{ secrets.NEWSDATAAPI_TOKEN }}
30+
run: |
31+
pytest
32+
python setup.py sdist bdist_wheel
33+
twine upload dist/*

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Byte-compiled / optimized / DLL files
66
project_env
77
my_test.py
8-
.github
98
.vscode/
109
__pycache__/
1110
*.py[cod]

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include *.py
21
include *.txt
2+
include *.py
33
include LICENSE
44
recursive-include tests *.py

examples/ex_newsdataapi_request.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
from newsdataapi import NewsDataApiClient
22

3+
34
# API key authorization, Initialize the client with your API key
45
api = NewsDataApiClient(apikey='API Key')
56

7+
68
# News API
79
response = api.news_api()
810
print(response)
911

12+
1013
# Archive API
1114
response = api.archive_api()
1215
print(response)
1316

17+
1418
# Sources API
1519
response = api.sources_api()
1620
print(response)

newsdataapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from newsdataapi.newsdataapi_client import NewsDataApiClient
1+
from newsdataapi.newsdataapi_client import NewsDataApiClient

newsdataapi/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# All the API URL and language suported by API.
1+
# All the Newsdata supported API URL
22
BASE_URL = 'https://newsdata.io/api/1/'
33

44
# Latest News URL

newsdataapi/helpers.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import time
22

3-
43
def get(request_method, URL, URL_parameters_encoded, proxies, request_timeout):
54
if proxies is None:
65
print(URL + "?" + URL_parameters_encoded)
76
return request_method.get(URL + "?" + URL_parameters_encoded, timeout=request_timeout)
87
else:
98
return request_method.get(URL + "?" + URL_parameters_encoded, timeout=request_timeout, proxies = proxies)
109

11-
1210
def MaxRetries(response, max_retries, retry_delay, request_method, URL, URL_parameters_encoded, proxies, request_timeout):
1311
while (max_retries):
1412
time.sleep(retry_delay)

newsdataapi/newsdataapi_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, apikey=None, session=None):
1919
Please make sure call session.close() after execute all calls to free up resource.
2020
:type session: requests.Session
2121
"""
22-
22+
2323
self.apikey = apikey
2424
# Check if session argument is None
2525
if session is None:

newsdataapi/newsdataapi_exception.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
class NewsdataException(Exception):
23
"""Base class for all other exceptions"""
34

newsdataapi/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import sys
22

3+
34
PY3 = sys.version_info[0] == 3
45

6+
57
if PY3:
68

79
def is_valid_string(lang):

0 commit comments

Comments
 (0)