Skip to main content

A python method based on the API of the coderHub.sa, which helps you to fetch the challenges and more

Project description


coderHub.sa - img
coderHub

A python method based on the API of the coderHub.sa, which helps you to fetch the challenges and more

PyPI - Python Version PyPI License

InstallationFeaturesUsageLicense

Installation

Use pypi to install coderHub.

pip3 install coderHub

Features

  • get all challenges or by difficulty
  • search for challenges
  • get challenge by id
  • get all languages info or by language name
  • get top 10 leaderboard by programming language
  • get user profile info
  • get user statistics info

Usage

get all challenges or by difficulty:

from coderHub import CoderHub

coder_hub = CoderHub()
# get all challenges
print(coder_hub.get_challenges())

#get by difficulty
print(coder_hub.get_challenges(difficulty="easy"))
Example for first Result
{
  "result":[
    {
    'id': '3e420f85-f4e9-4e7a-b6bc-f35a8db70cb4', 
    'title': 'طرح عددين', 
    'challenge_tags': [{'name': 'Math'}], 
    'points': 5, 
    'created_by': 
    {'username': 'CoderHub', 'public': False}, 
    'creator_role': 'admin', 
    'hint_text': None, 
    'hint_points': None, 
    'challenge_programming_languages': [], 
    'type_of_level': {'id': 2, 'name': 'سهل'}
    }
}


search for challenges:

from coderHub import CoderHub
coder_hub = CoderHub()

print(coder_hub.search_challenges(word="تاريخ"))
Example Result
{'count': 2,
 'result': [{'challenge_programming_languages': [],
             'challenge_tags': [{'name': 'Date'}, {'name': 'String'}],
             'created_by': {'public': False, 'username': 'CoderHub'},
             'creator_role': 'admin',
             'hint_points': None,
             'hint_text': None,
             'id': 'c93a5e09-2578-42ec-95db-88d1e87d6459',
             'points': 10,
             'title': 'تاريخ اليوم',
             'type_of_level': {'id': 3, 'name': 'متوسط'}},
            {'challenge_programming_languages': [],
             'challenge_tags': [{'name': 'Date'}, {'name': 'String'}],
             'created_by': {'public': False, 'username': 'CoderHub'},
             'creator_role': 'admin',
             'hint_points': None,
             'hint_text': None,
             'id': 'a2df08ef-faa1-4aaf-bbd5-66f7e021855a',
             'points': 10,
             'title': 'تعديل صيغة التاريخ',
             'type_of_level': {'id': 3, 'name': 'متوسط'}}]}


get challenge by id:

from coderHub import CoderHub

coder_hub = CoderHub()
print(coder_hub.get_challenge_by_id(challenge_id='3e420f85-f4e9-4e7a-b6bc-f35a8db70cb4'))
Example Result
{
    'id': '3e420f85-f4e9-4e7a-b6bc-f35a8db70cb4', 
    'title': 'طرح عددين', 
    'description': '### وصف التحدي\r\nقم بكتابة `function` تستقبل عددين، العدد الأول يمثل رقماً صحيحاً `integer` والعدد الثاني يمثل أيضا رقماً صحيحاً `integer` ، ثم قم بإرجاع حاصل **طرح** هذين العددين.\r\n\r\n### المخرجات المتوقعة\r\n| Output  | b  | a |\r\n|----|----|----|\r\n| 5 | 5  | 10 |\r\n| 6 | -3  | 3 |\r\n| -5 | 1 | -4 |\r\n| 1 | -1 | 0 |\r\n| 0 | 0 | 0 |\r\n| -92 | -4 | -96 |', 
    'timed': True, 
    'time_limit': 5, 
    'points': 5
    // and more ...
}


get languages:

from coderHub import CoderHub

coder_hub = CoderHub()

# all languages
print(coder_hub.get_languages())

# language by name
print(coder_hub.get_languages(language="python"))
Example Result
// all languages

{
  'result': [
  {'id': 6, 'name': 'swift', 'version': 'swift 4.2.2'}, 
  {'id': 3, 'name': 'python', 'version': 'python 3.5.3'}, 
  {'id': 2, 'name': 'javascript', 'version': 'SMonkey 68.6.0'}, 
  {'id': 1, 'name': 'java', 'version': 'jdk 8u51'}, 
  {'id': 8, 'name': 'c#', 'version': 'Mono 4.0.2'}
  ]
}

// language by name
{
  'id': 3, 
  'name': 'python', 
  'version': 
  'python 3.5.3'
}




get leaderboard:

from coderHub import CoderHub

coder_hub = CoderHub()

print(coder_hub.get_leaderBoard(language="Python", search_type="DAILY"))
Example Result
{
  'leaderboard': 
  [
    {'points': 5, 'total_time': 12.155752, 'user_id': '8e0d0f0c-6884-4a9e-a28a-b9d6f3094407', 'rank': 1, 'user_info': {'username': 'ismm', 'public': False}
    }
  ]
}


get user profile:

from coderHub import CoderHub

coder_hub = CoderHub()

print(coder_hub.get_profile(username="thamermashni"))
Example Result
{'preferred_language': 'Python',
 'user_badges': [],
 'user_information': {'are_you_a_trainer': None,
                      'bio': 'Computer Science fresh graduate from King Fahad '
                             'University of Petroleum & Minerals',
                      'certificates': [{'expired': False,
                                        'expires_at': '2021-02-01T00:00:00+00:00',
                                        'institution': 'Udacity',
                                        'is_training_certificate': False,
                                        'name': 'Full-Stack Developer '
                                                'Nanodegree',
                                        'received_at': '2020-12-04T00:00:00+00:00'}],
                      'city': 'ابها',
                      'country_name': 'المملكة العربية السعودية',
                      'education': [{'end_at': '2020-02-17T00:00:00+00:00',
                                     'institution': 'جامعة الملك فهد للبترول '
                                                    'والمعادن',
                                     'major': 'Computer Science',
                                     'name': 'bachelor',
                                     'start_at': '2014-02-17T00:00:00+00:00'}],
                      'extra_public_fields': [],
                      'first_name': 'ثامر',
                      'id': 'fd0c7a26-e1de-40f8-af51-8be885a59e3b',
                      'is_looking_for_job': None,
                      'last_name': 'مشني',
                      'looking_for_job_type': None,
                      'occupation': None,
                      'preferred_language': None,
                      'programming_languages': [{'experience': 'أقل من سنة',
                                                 'programming_language': 'Java'},
                                                {'experience': 'أقل من سنة',
                                                 'programming_language': 'JavaScript'},
                                                {'experience': 'أقل من سنة',
                                                 'programming_language': 'Python'},
                                                {'experience': 'أقل من سنة',
                                                 'programming_language': 'SQL'},
                                                {'experience': 'أقل من سنة',
                                                 'programming_language': 'C#'}],
                      'public_profile': True,
                      'social_links': [{'handle': 'ThamerMashni',
                                        'site': 'GITHUB'},
                                       {'handle': 'thamermashni',
                                        'site': 'LINKEDIN'},
                                       {'handle': '', 'site': 'TWITTER'}],
                      'username': 'thamermashni'}}


get user statistics:

from coderHub import CoderHub
coder_hub = CoderHub()

print(coder_hub.get_user_statistics(username='thamermashni'))
Example Result
{'programming_languages': [{'name': 'سهل',
                            'programming_language_name': 'Python',
                            'solved_challenges': 58},
                           {'name': 'صعب',
                            'programming_language_name': 'Python',
                            'solved_challenges': 11},
                           {'name': 'متوسط',
                            'programming_language_name': 'Python',
                            'solved_challenges': 31},
                           {'name': 'متوسط',
                            'programming_language_name': 'JavaScript',
                            'solved_challenges': 1}],
 'total_solved_challenges': 101,
 'total_solved_per_programming_language': [{'programming_language_name': 'JavaScript',
                                            'total_solved': 1},
                                           {'programming_language_name': 'Python',
                                            'total_solved': 100}]}


LICENSE

GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coderHub-1.0.7.tar.gz (18.5 kB view hashes)

Uploaded Source

Built Distribution

coderHub-1.0.7-py3-none-any.whl (18.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page