From a325cb889adca46e0b67a8199dfa3f1e3262116b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Jun 2021 15:54:42 +0530 Subject: [PATCH 1/6] Bump urllib3 from 1.25.8 to 1.26.5 (#21) Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.8 to 1.26.5. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.25.8...1.26.5) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 61c7ac5..c44676a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,6 +16,6 @@ pytz==2019.3 requests==2.22.0 six==1.14.0 soupsieve==1.9.5 -urllib3==1.25.8 +urllib3==1.26.5 Werkzeug==0.16.1 selenium==3.141.0 \ No newline at end of file From af7bab178b132018689fb1f4e90a57ba4859f9cc Mon Sep 17 00:00:00 2001 From: Abhijeet Reddy Date: Sun, 20 Jun 2021 15:59:11 +0530 Subject: [PATCH 2/6] fix retriving user's name issue in codechef this resolves #22 --- details_soup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/details_soup.py b/details_soup.py index fbae545..a09ad02 100644 --- a/details_soup.py +++ b/details_soup.py @@ -147,7 +147,7 @@ def problems_solved_get(): def user_details_get(): header_containers = soup.find_all('header') - name = header_containers[1].find('h2').text + name = header_containers[1].find('h1', class_="h2-style").text user_details_section = soup.find('section', class_='user-details') user_details_list = user_details_section.find_all('li') From 5cada7e93cc449678bfa9653b0095654943b114a Mon Sep 17 00:00:00 2001 From: Abhijeet Reddy Date: Sun, 27 Jun 2021 21:56:49 +0530 Subject: [PATCH 3/6] add stale bot to close inactive issues --- .github/stale.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..4e42b32 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,16 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +onlyLabels: + - answered +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false \ No newline at end of file From 61056303d22039ac573f459b634dbf1d03c89233 Mon Sep 17 00:00:00 2001 From: Abhijeet Reddy Date: Sun, 17 Oct 2021 13:19:28 +0530 Subject: [PATCH 4/6] fixed issue #23 --- details_soup.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/details_soup.py b/details_soup.py index a09ad02..0ebc175 100644 --- a/details_soup.py +++ b/details_soup.py @@ -146,18 +146,24 @@ def problems_solved_get(): return fully_solved, partially_solved def user_details_get(): + user_details_attribute_exclusion_list = {'username', 'link', 'teams list', 'discuss profile'} + header_containers = soup.find_all('header') name = header_containers[1].find('h1', class_="h2-style").text user_details_section = soup.find('section', class_='user-details') user_details_list = user_details_section.find_all('li') - return {'name': name, 'username': user_details_list[0].text.split('★')[-1].rstrip('\n'), - 'country': user_details_list[1].text.split(':')[-1].strip(), - 'state': user_details_list[2].text.split(':')[-1].strip(), - 'city': user_details_list[3].text.split(':')[-1].strip(), - 'student/professional': user_details_list[4].text.split(':')[-1].strip(), - 'institution': user_details_list[5].text.split(':')[-1].strip()} + user_details_response = {'name': name, 'username': user_details_list[0].text.split('★')[-1].rstrip('\n')} + for user_details in user_details_list: + attribute, value = user_details.text.split(':')[:2] + attribute = attribute.strip().lower() + value = value.strip() + + if attribute not in user_details_attribute_exclusion_list: + user_details_response[attribute] = value + + return user_details_response full, partial = problems_solved_get() details = {'status': 'Success', 'rating': int(rating), 'stars': stars, 'highest_rating': int(highest_rating), From 051952997f8e399840b2a738700d589d228694ad Mon Sep 17 00:00:00 2001 From: Yash Eksambekar <49578836+samba9274@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:51:51 +0530 Subject: [PATCH 5/6] Adapted to new codechef page layout (#31) --- details_soup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/details_soup.py b/details_soup.py index 0ebc175..f257b3f 100644 --- a/details_soup.py +++ b/details_soup.py @@ -56,13 +56,14 @@ def __codechef(self): global_rank = rating_ranks[0].strong.text country_rank = rating_ranks[1].strong.text - if global_rank != 'NA': + if global_rank != 'NA' and global_rank != 'Inactive': global_rank = int(global_rank) country_rank = int(country_rank) def contests_details_get(): rating_table = soup.find('table', class_='rating-table') - + if not rating_table: + return [] rating_table_rows = rating_table.find_all('td') '''Can add ranking url to contests''' From ac0a3c0cfbf1715e02f1638f9732eb895e1299ea Mon Sep 17 00:00:00 2001 From: Abhijeet Reddy Date: Mon, 6 Jun 2022 19:10:54 +0530 Subject: [PATCH 6/6] upgrade requests, urllib dependencies --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c44676a..74267db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,9 +13,10 @@ itsdangerous==1.1.0 Jinja2==2.11.3 MarkupSafe==1.1.1 pytz==2019.3 -requests==2.22.0 +requests==2.27.1 +selenium==3.141.0 six==1.14.0 soupsieve==1.9.5 -urllib3==1.26.5 +urllib3==1.26.9 Werkzeug==0.16.1 selenium==3.141.0 \ No newline at end of file