Skip to content

Commit 3fbf91b

Browse files
committed
Add version information to package
1 parent 44f0181 commit 3fbf91b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed
File renamed without changes.

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
[metadata]
22
name = campusnet
33
description = Python Package to interface with CampusNet by Datenlotsen.
4+
long_description = file: README.md
5+
long_description_content_type = text/markdown
46
author = CS-Studis
7+
version = attr: campusnet.VERSION
58
license = GPL-3.0
69
license_file = LICENSE
710
platforms = unix, linux, osx, cygwin, win32

src/campusnet/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import requests
55
from bs4 import BeautifulSoup
66

7-
__version__ = (0, 0, 1)
7+
VERSION = "0.3"
88

99

1010
class LoginError(ValueError):
@@ -170,7 +170,8 @@ def _get_modules(self):
170170
modules.append(Module(
171171
num=num,
172172
name=cells[1].text.strip(),
173-
credits=float(cells[3].text.strip().replace(',', '.')),
173+
credits=float(
174+
cells[3].text.strip().replace(',', '.')),
174175
status=cells[4].text.strip(),
175176
semesters=[semester],
176177
id=exams_id,
@@ -203,7 +204,8 @@ def get_exams_for_module(self, module: Module):
203204
:param module: The module.
204205
:return: A list of exams.
205206
"""
206-
response = self.session.get(self.create_url('RESULTDETAILS', f",-N{module.id}"))
207+
response = self.session.get(self.create_url(
208+
'RESULTDETAILS', f",-N{module.id}"))
207209
# The webservice doesn't correctly set Content-Type: text/html; charset=utf-8
208210
# so requests uses ISO-8859-1 which is not correct. Requests is smart enough to
209211
# convert the response to UTF-8 if we tell it to take a guess at the real encoding.
@@ -216,7 +218,8 @@ def get_exams_for_module(self, module: Module):
216218
for row in exam_table.find_all("tr"):
217219
cells = row.find_all('td')
218220
if len(cells) == 1 and 'level02' in cells[0]["class"]:
219-
current_heading = cells[0].text.strip() # variable to persist header into the next iteration
221+
# variable to persist header into the next iteration
222+
current_heading = cells[0].text.strip()
220223
if len(cells) == 6 and all("tbdata" in cell["class"] for cell in cells):
221224
try:
222225
grade = float(cells[3].text.strip().replace(",", "."))

src/campusnet/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
while True:
2323
try:
24-
s = campusnet.CampusNetSession(args.username, password)
24+
s = campusnet.CampusNetSession(
25+
args.username, password, args.base_url)
2526
break
2627
except campusnet.LoginError as e:
2728
print("Invalid username or password.")

0 commit comments

Comments
 (0)