{"id":23339817,"url":"https://github.com/xiyusullos/requests-rest","last_synced_at":"2025-04-07T14:39:58.270Z","repository":{"id":57461362,"uuid":"320211921","full_name":"xiyusullos/requests-rest","owner":"xiyusullos","description":"An elegant RESTful client based on requests.","archived":false,"fork":false,"pushed_at":"2022-09-07T13:38:50.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T17:47:18.158Z","etag":null,"topics":["api","api-client","python","requests","rest","rest-api","rest-client"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiyusullos.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-10T08:46:13.000Z","updated_at":"2022-03-07T17:41:31.000Z","dependencies_parsed_at":"2022-09-17T08:11:28.025Z","dependency_job_id":null,"html_url":"https://github.com/xiyusullos/requests-rest","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiyusullos%2Frequests-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiyusullos%2Frequests-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiyusullos%2Frequests-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiyusullos%2Frequests-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiyusullos","download_url":"https://codeload.github.com/xiyusullos/requests-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247672997,"owners_count":20977046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","python","requests","rest","rest-api","rest-client"],"created_at":"2024-12-21T04:15:20.965Z","updated_at":"2025-04-07T14:39:58.243Z","avatar_url":"https://github.com/xiyusullos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Requests-REST: A RESTful client based on requests\n=================================================\n\nThis library intends to provide an elegant RESTful client.\n\n\nInstallation\n============\n\n.. code-block:: shell\n\n    pip install requests-rest\n\n\nUsage example\n=============\n.. code-block:: shell\n\n    base_url = 'https://httpbin.org/'\n\n    new_name = 'aponder'\n    new_email = 'i@aponder.top'\n    new_user = {\n        'name': new_name,\n        'email': new_email,\n    }\n    update_user = new_user.copy()\n    update_user.update({'name': f'new {new_name}'})\n\n    # print(resource_user.list().json())\n    # print(resource_user.create(new_user).json())\n    # print(resource_user.update(1, new_user).json())\n    # print(resource_user.patch(1, new_name).json())\n    # print(resource_user.patch(1, new_email).json())\n    # print(resource_user.delete(1).json())\n\n    resource_client = Client(base_url, debug=True)\n    Users = resource_client('users')\n\n    users_creating = Users.create(new_user)\n    print(users_creating.response)\n\n    users_listing = Users.list(page=1, page_size=10)\n    print(users_listing.response)\n\n    users_detailing = Users.detail(1)\n    print(users_detailing.response)\n\n    users_updating = Users.update(2, update_user)\n    print(users_updating.response)\n\n    users_partial_updating = Users.partial_update(3, update_user)\n    print(users_partial_updating.response)\n\n    users_deleting = Users.delete(4)\n    print(users_deleting.response)\n\n    # extra actions\n    Users.login = Users.make_plural_action('login')\n    credentials = {'username': 'root', 'password': 'root'}\n    print(Users.login(credentials).response)\n\n    Users.disable = Users.make_single_action('disable')\n    print(Users.disable(2).response)\n\n    # resource combination\n    Blogs = resource_client('blogs')\n    UsersBlogs = users_detailing(Blogs)\n\n    new_blog = {'title': 'hello'}\n    print(UsersBlogs.create(new_blog).response)\n    print(UsersBlogs.list(page=2, page_size=20).response)\n    print(UsersBlogs.delete(10).response)\n    print(UsersBlogs.update(10, new_blog).response)\n    print(UsersBlogs.partial_update(10, new_blog).response)\n    print(UsersBlogs.delete(10).response)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiyusullos%2Frequests-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiyusullos%2Frequests-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiyusullos%2Frequests-rest/lists"}