codetime package¶
Subpackages¶
Submodules¶
codetime.admin module¶
codetime.apps module¶
codetime.models module¶
-
class
codetime.models.TimeLog(*args, **kwargs)¶ Bases:
django.db.models.base.ModelDescription for Time Logging DB Model
- Variables
log_file_time_id – Primary key indexing each time log of a file of a user
api_token – unique token for each user
file_name – file being edited by user
file_extension – extension of the file (or file type)
detected_language – language in the file
log_date – date of when was the file logged
start_timestamp – start time recorded for activity on file
end_timestamp – end time recorded for activity on file
created_at – timestamp of when file was created
modified_at – timestamp of when file was modified last
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
api_token¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created_at¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
detected_language¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
end_timestamp¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_extension¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file_name¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)¶
-
get_next_by_log_date(*, field=<django.db.models.fields.DateField: log_date>, is_next=True, **kwargs)¶
-
get_next_by_modified_at(*, field=<django.db.models.fields.DateTimeField: modified_at>, is_next=True, **kwargs)¶
-
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)¶
-
get_previous_by_log_date(*, field=<django.db.models.fields.DateField: log_date>, is_next=False, **kwargs)¶
-
get_previous_by_modified_at(*, field=<django.db.models.fields.DateTimeField: modified_at>, is_next=False, **kwargs)¶
-
log_date¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
log_file_time_id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
modified_at¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects= <codetime.models.TimeLogManager object>¶
-
start_timestamp¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
codetime.models.TimeLogManager¶ Bases:
django.db.models.manager.Manager-
static
create_log(time_log)¶ Create a new log for a file for a particular user
- Parameters
time_log (dict) – validated time log details from post request
- Returns
return status
- Return type
int
-
get_file_name_extension_wise_summary(api_token)¶ Get fileextension wise log summary for a particular user
- Parameters
api_token (str) – unique token for each user
- Returns
list of all the file logs of the user
- Return type
list
-
get_time_logs(api_token)¶ Get all the filelogs for a particular user
- Parameters
api_token (str) – unique token for each user
- Returns
list of all the file logs of the user
- Return type
list
-
get_time_spent_per_coding_language(api_token)¶ Get the record for time spent on various codeing languages for a particular user
- Parameters
api_token (str) – unique token for each user
- Returns
list of time spent per coding language for the user
- Return type
list
-
get_time_spent_per_file(api_token)¶ Get the record for time spent on on each of the file for a particular user
- Parameters
api_token (str) – unique token for each user
- Returns
list of time spent per file for the user
- Return type
list
-
get_weekday_count_summary(api_token)¶ Get weekday’s summary for a particular user
- Parameters
api_token (str) – unique token for each user
- Returns
list of count of logs per day of the user
- Return type
list
-
static
-
class
codetime.models.User(*args, **kwargs)¶ Bases:
django.db.models.base.ModelDescription for User DB Model
- Variables
log_user_id – Primary key indexing each user
username – unique username of the user
password – password of the user
api_token1 – unique token for each user stored for sublime activity
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
api_token¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
log_user_id¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects= <codetime.models.UserManager object>¶
-
password¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
username¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
codetime.models.UserManager¶ Bases:
django.db.models.manager.ManagerAPIs for the User Performs User actions (CRUD operations) for signup, login and updating user.
-
static
create_user(user)¶ Create a new user.
- Parameters
user (dict) – validated user details from post request
- Returns
response status (0 for failure, 1 for success and 2 for DB error)
- Return type
int
-
get_user_from_api_token(api_token)¶ Returns the user details using the unique API token of the user.
- Parameters
api_token (str) – unique apitoken of user
- Returns
dictionary response
- Return type
object
-
get_user_from_username(username, password)¶ Returns the user details using the login credentails (basic auth) of the user.
- Parameters
username (str) – username of the user
password (str) – password of user
- Returns
dictionary response
- Return type
object
-
login(username, password)¶ Login a user using basic auth
- Parameters
username (str) – username of the user
password (str) – password of user
- Returns
api_token is such user exists
- Return type
str
-
update_user(user, api_token)¶ Update user information.
- Parameters
user (dict) – validated user details from post request
api_token (str) – unique apitoken of user
- Returns
response status (0 for success, 1 for no such user with api_token)
- Return type
int
-
static
codetime.request_handlers module¶
This modules has functions to handle all the supported commands for the codetime server’s APIs.
-
codetime.request_handlers.get_invalid_request_param(message)¶ Returns error response for invalid request parameters
- Parameters
error (str) – message
- Returns
error_response
- Return type
object
-
codetime.request_handlers.get_invalid_user_credentials(data=None)¶ Returns error response for invalid user credentials
- Parameters
data (str) – message
- Returns
response
- Return type
object
-
codetime.request_handlers.get_missing_param_response(data=None)¶ Returns error response for missing parameters
- Parameters
data (str) – message
- Returns
response
- Return type
object
-
codetime.request_handlers.get_serializer_error_response(error)¶ Returns error response from serializer
- Parameters
error (str) – message
- Returns
error_response
- Return type
object
-
codetime.request_handlers.get_something_went_wrong_response(data=None)¶ Returns error response for server related error
- Parameters
data (str) – message
- Returns
response
- Return type
object
-
codetime.request_handlers.get_valid_output_response(data)¶ Returns success message correct processing of post/get request
- Parameters
data (str) – message
- Returns
response
- Return type
object
-
codetime.request_handlers.get_valid_post_response(data)¶ Returns success message correct processing of post/get request
- Parameters
data (str) – message
- Returns
response
- Return type
object
-
codetime.request_handlers.handle_get_file_logs(request)¶ Handler for get request to obtain all records for a user.
- Parameters
GET request (HTTP) – request
- Returns
response
- Return type
object
-
codetime.request_handlers.handle_log_file_post(request)¶ Handler for post request made by logging files
- Parameters
POST request (HTTP) – request
- Returns
response
- Return type
object
-
codetime.request_handlers.handle_summary_request(request)¶ Handler for get request to summary records for a user.
- Parameters
GET request (HTTP) – request
- Returns
response
- Return type
object
-
codetime.request_handlers.handle_user_get(request)¶
-
codetime.request_handlers.handle_user_post(request)¶ Handler for post request made by a user to signup and login
- Parameters
POST request (HTTP) – message
- Returns
response
- Return type
object
codetime.serializers module¶
codetime.urls module¶
codetime.views module¶
-
class
codetime.views.TimeLogSummaryView(**kwargs)¶ Bases:
rest_framework.generics.ListAPIViewTimeLog Summary View
-
get(request, *args, **kwargs)¶ TimeLogSummary get request
-