{"id":22114022,"url":"https://github.com/plinss/json_home_client","last_synced_at":"2025-07-25T08:31:14.497Z","repository":{"id":11571024,"uuid":"14059032","full_name":"plinss/json_home_client","owner":"plinss","description":"A client class for calling HTTP APIs in Python. Supports URI templates and JSON home pages.","archived":false,"fork":false,"pushed_at":"2020-06-16T03:48:16.000Z","size":44,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-09T18:23:28.648Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plinss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-02T02:36:13.000Z","updated_at":"2024-08-07T17:01:02.000Z","dependencies_parsed_at":"2022-07-13T10:10:31.853Z","dependency_job_id":null,"html_url":"https://github.com/plinss/json_home_client","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinss%2Fjson_home_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinss%2Fjson_home_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinss%2Fjson_home_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plinss%2Fjson_home_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plinss","download_url":"https://codeload.github.com/plinss/json_home_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227544348,"owners_count":17785198,"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":[],"created_at":"2024-12-01T11:08:21.924Z","updated_at":"2024-12-01T11:08:22.488Z","avatar_url":"https://github.com/plinss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"json_home_client\n================\n\nClient class for calling http+json APIs in Python. Requires Python 3.6+.\n\nSupports json home pages per:\nhttps://tools.ietf.org/html/draft-nottingham-json-home-06\n\n\nInstallation\n------------\nStandard python package installation:\n\n       pip install json-home-client\n\n\nUsage\n-----\nImport the json_home_client package and instantiate a client.\n\n       from json_home_client import Client\n\n       api = Client('http://api.example.com')\n\nCall APIs:\n\n       result = api.call('foo', var1=arg1, var2=arg2)\n       print result.data\n\n\nClient class\n---------------\n**class json_home_client.Client(base_url: str, version: str = None, username: str = None, password: str = None, user_agent: str = None,\n                                sni_hostname: str = None, client_cert_path: str = None, client_key_path: str = None, ca_cert_path: str = None)**\n\nThe Client constructor takes the base URL for the api, an optional request version identifier, username and password.\nIt also allows a custom sni_hostname (useful when the url uses an ip address), client certificate and key, \nand a custom CA file path.\n\n**Client.base_url: str**\n\nThe base URL set in the constructor, read-only.\n\n**Client.default_version: Optional[str]**\n\nThe default version information for accept headers.\n\n**Client.default_accept: MimeType**\n\nThe default accept types for API calls.\n\n**Client.username: Optional[str]**\n\nUsername to send in HTTP authentication header.\n\n**Client.password: Optional[str]**\n\nPassword to send in HTTP authentication header.\n\n**Client.user_agent: str**\n\nThe User-Agent string to send in requests.\n\n**Client.resource_names: Sequence[str]**\n\nA list of available API resource names.\n\n**Client.resource(name: str) -\u003e Resource**\n\nGet a named Resource.\n\n**Client.add_resource(name: str, url: str) -\u003e None**\n\nAdd a URL resource.\n\n**Client.set_version(name: str, version: str = None) -\u003e None**\n\nSet the request version identifier for a specific resource. If not set, the default version identifer will be used.\n\n**Client.set_accept(name: str, content_type: Union[MimeType, Sequence[MimeType]]) -\u003e None**\n\nSet the requested Content-Type(s) for a specific resource. If not set, 'application/json' will be used.\n\n**Client.get(name: str, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP GET on the named resource. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.post(name: str, payload: bytes, content_type: MimeType = None, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP POST on the named resource. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.post_form(name: str, payload: Mapping[str, Any] = None, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP POST on the named resource. The payload, if present, will be URL form encoded. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.post_json(name: str, payload: Any = None, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP POST on the named resource. The payload, if present, will be converted to JSON. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.put(name: str, payload = None, content_type: MimeType = None, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP PUT on the named resource. The payload, if present, will be sent to the server using the provided Content-Type. The payload must be pre-encoded and will not be processed by the Client. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.patch(name: str, patch: Mapping[str, Any] = None, content_type: MimeType = MimeType.JSON_PATCH, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP PATCH on the named resource. The patch, if present, will be encoded in JSON and sent to the server as a 'application/json-patch'. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n**Client.delete(name: str, [kwargs]) -\u003e Optional[Response]**\n\nPerform an HTTP DELETE on the named resource. Any named arguments supplied may be used in computing the actual URL to call. Returns a Response or None if the resource name is not known.\n\n\nResponse class\n-----------------\n**Response.status_code: int**\n\nThe HTTP status code of the response.\n\n**Response.headers: Mapping[str, Any]**\n\nA dict of HTTP response headers.\n\n**Response.conten_type: MimeType**\n\nThe Content-Type of the response.\n\n**Response.encoding: str**\n\nThe encoding of the response.\n\n**Response.data: Any**\n\nThe body of the response. If the contentType is json, the data will be decoded into native objects.\n\n\nResource class\n-----------------\nDescribes the properties of an available API resource.\n\n**Resource.template**\n\nThe URITemplate used when calling the resource.\n\n**Resource.variables**\n\nA dict of variables that may be passed to the resource. Keys are variable names, values are the URL identifier of the variable, if available (see https://tools.ietf.org/html/draft-nottingham-json-home-06#section-4.1 ).\n\n**Resource.hints**\n\nAn Hints object describing any hints for the resource (see https://tools.ietf.org/html/draft-nottingham-json-home-06#section-5 ).\n\n\nHints class\n--------------\n**Hints.http_methods: Sequence[str]**\n\nA list of HTTP methods the resource may be called with.\n\n**Hints.formats: Mapping[str, Sequence[MimeType]]**\n\nA dict of formats available for each HTTP method. Keys are HTTP methods, values are a list of Content-Types available.\n\n**Hints.ranges: Optional[Sequence[str]]**\n\nA list of range specifiers.\n\n**Hints.preferences: Optional[Sequence[str]]**\n\nA list of preferences supported by the resource.\n\n**Hints.preconditions: Optional[Sequence[str]]**\n\nA list of preconditions required by the resource.\n\n**Hints.auth: Optional[Sequence[Mapping[str, str]]]**\n\nA list of authorization schemes accepted by the resource.\n\n**Hints.docs: Optional[str]**\n\nA URL for documentation for the resource.\n\n**Hints.status: Optional[str]**\n\nThe status of the resource.\n\n\nMimeType class\n--------------\n**MimeType(mime_type: str = None, type: str = None, structure: str = None, subtype: str = None)**\n\nConstructor, accepts a mime_type, which will be parsed, or individual components.\n\n**MimeType.type: str**\n\nThe primary type, e.g. \"application/json\" -\u003e \"application\"\n\n**MimeType.structure: Optional[str]**\n\nThe structure, e.g. \"application/json\" -\u003e \"json\", \"application/vnd.app.v1+json\" -\u003e \"json\"\n\n**MimeType.subtype: Optional[str]**\n\nThe subtype, e.g. \"application/vnd.app.v1+json\" -\u003e \"vnd.app.v1\"\n\n\nNotes\n-----\nResource names may be absolute URLs or relative to the base URL of the API.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplinss%2Fjson_home_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplinss%2Fjson_home_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplinss%2Fjson_home_client/lists"}