Skip to content

Commit

Permalink
Merge pull request #739 from serihiro/fix-key-error
Browse files Browse the repository at this point in the history
Skip language option tags without `value` at AtCoder
  • Loading branch information
kmyk authored May 1, 2020
2 parents 77b6306 + 577b1d9 commit e533390
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion onlinejudge/service/atcoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,9 @@ def _parse_available_languages(cls, soup: bs4.BeautifulSoup, problem: 'AtCoderPr
select = form.find('div', id='select-lang').find('select', attrs={'name': 'data.LanguageId'}) # NOTE: AtCoder can vary languages depending on tasks, even in one contest. here, ignores this fact.
languages = [] # type: List[Language]
for option in select.find_all('option'):
languages += [Language(option.attrs['value'], option.string)]
# As of May 1st 2020, the first option does not have a value element.
if 'value' in option.attrs:
languages += [Language(option.attrs['value'], option.string)]
return languages

@classmethod
Expand Down

0 comments on commit e533390

Please sign in to comment.