Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion codeforces_api/api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def user_rating(self, handle):
)
]

def user_status(self, handle, start=-1, count=-1):
def user_status(self, handle, start=-1, count=-1, include_sources=False):
"""
Get user.status.

Expand All @@ -376,6 +376,8 @@ def user_status(self, handle, start=-1, count=-1):

count is the number of attempts to return.

include_sources is used to include sources in the response, must be your own handle.

Returns parsed response from codeforces.com.
"""
parameters = {
Expand All @@ -385,6 +387,8 @@ def user_status(self, handle, start=-1, count=-1):
parameters["from"] = str(start)
if count != -1:
parameters["count"] = str(count)
if include_sources:
parameters["includeSources"] = "true"
return [
Submission.de_json(submission)
for submission in self._make_request("user.status", **parameters)
Expand Down
7 changes: 6 additions & 1 deletion codeforces_api/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

import json

import base64

class Dictionaryable(object):
"""
Expand Down Expand Up @@ -661,6 +661,7 @@ def de_json(cls, json_string):
contest_id = obj.get("contestId")
verdict = obj.get("verdict")
points = obj.get("points")
source_code = obj.get("sourceBase64")
return cls(
identifier,
creation_time_seconds,
Expand All @@ -675,6 +676,7 @@ def de_json(cls, json_string):
contest_id,
verdict,
points,
base64.b64decode(source_code).decode() if source_code else None,
)

def __init__(
Expand All @@ -692,6 +694,7 @@ def __init__(
contest_id=None,
verdict=None,
points=None,
source_code=None,
):
self.id = identifier
self.creation_time_seconds = creation_time_seconds
Expand All @@ -706,6 +709,7 @@ def __init__(
self.contest_id = contest_id
self.verdict = verdict
self.points = points
self.source_code = source_code

def to_dict(self):
return {
Expand All @@ -722,6 +726,7 @@ def to_dict(self):
"contest_id": self.contest_id,
"verdict": self.verdict,
"points": self.points,
"source_code": self.source_code
}


Expand Down
Loading