Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspasser committed Feb 1, 2019
1 parent af6ec41 commit 677f9bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 5 additions & 1 deletion rjpl/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
def _request(service, params, timeout):
params['format'] = 'json'

response = requests.get(RESOURCE+service, params, timeout=timeout)

try:
response = requests.get(RESOURCE+service, params, timeout=timeout)
except requests.exceptions.RequestException as e:
raise RuntimeError(e)

if response.status_code == 200:
return response.json()
Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/usr/bin/env python
from setuptools import setup

with open("README.md", "r") as fh:
long_description = fh.read()

setup(
name = 'rjpl',
packages = ['rjpl'],
version = '0.3.1',
version = '0.3.2',
license='MIT',
description = 'Interface with Rejseplanen API',
long_description=long_description,
long_description_content_type="text/markdown",
author = 'Thomas Passer Jensen',
author_email = 'tomatpasser@gmail.com',
url = 'https://github.com/tomatpasser/python-rejseplanen',
download_url = 'https://github.com/tomatpasser/python-rejseplanen/archive/v0.3.1.tar.gz',
download_url = 'https://github.com/tomatpasser/python-rejseplanen/archive/v0.3.2.tar.gz',
keywords = ['transport', 'rejseplanen', 'timetable', 'journey', 'public transport'],
install_requires=[
'requests>=2.9.1',
Expand Down

0 comments on commit 677f9bd

Please sign in to comment.