{"id":25588598,"url":"https://github.com/picketapi/picket-python","last_synced_at":"2026-04-11T05:30:16.816Z","repository":{"id":62068228,"uuid":"557039404","full_name":"picketapi/picket-python","owner":"picketapi","description":"The official Python library for the Picket API","archived":false,"fork":false,"pushed_at":"2022-10-25T23:09:23.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T05:04:43.091Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/picketapi.png","metadata":{"files":{"readme":"README.md","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":"2022-10-25T01:12:36.000Z","updated_at":"2022-10-25T01:16:00.000Z","dependencies_parsed_at":"2022-10-26T01:00:39.797Z","dependency_job_id":null,"html_url":"https://github.com/picketapi/picket-python","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picketapi%2Fpicket-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picketapi%2Fpicket-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picketapi%2Fpicket-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/picketapi%2Fpicket-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/picketapi","download_url":"https://codeload.github.com/picketapi/picket-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239985714,"owners_count":19729512,"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":"2025-02-21T08:38:57.768Z","updated_at":"2026-04-11T05:30:16.763Z","avatar_url":"https://github.com/picketapi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# picket-python\n\nThe official Python library for the [Picket API](https://picketapi.com/)\n\n## Installation\n\n```bash \npip install -U picketapi\n```\n\n## Usage - Quick Start\n\nUse the `Picket` class to create the Picket API client. It takes a _secret API key_ as a parameter.\n\n```python\nfrom picketapi import Picket\n\npicket = new Picket(\"YOU_SECRET_API_KEY\")\n```\n\n## Nonce\n\nA `nonce` is random value generated by the Picket API to that user must sign to prove ownership a wallet address. The `nonce` function can be used to implement your own wallet authentication flow. \n\nA nonce is unique to a project and wallet address. If a `nonce` doesn't exist for the project and wallet address, Picket will generate a new nonce; otherwise, Picket will return the existing nonce. A nonce is valid for two minutes before self-destructing.\n\n```python\nresp = picket.nonce(chain=\"solana\", wallet_address=\"wAlLetTAdDress\")\n# resp is of type NonceResponse\nprint(resp.nonce)\n```\n\n## Auth\n\n`auth` is the server-side equivalent of login. `auth` should only be used in a trusted server environment. The most common use-case for `auth` is [linking a wallet to an existing application account](https://docs.picketapi.com/picket-docs/tutorials/link-a-wallet-to-a-web-2.0-account).\n\n```python\nresp = picket.auth(chain=\"ethereum\", wallet_address=\"0x1234567890\", signature=\"abcdefghijklmnop\")\n# resp is of type AuthResponse\nprint(resp.user)\nprint(resp.access_token)\n```\n\n## Authz (Authorize)\n`authz` stands for authorization. Unlike Auth, which handles both authentication and authorization, Authz only handles authorization. \nGiven an authenticated user's access token and authorization requirements, `authz` will issue a new access token on success (user is authorized) or, on failure, it will return a 4xx HTTP error code.\n\n```python\nresp = picket.authz(access_token=\"xxx.yyy.zzz\", requirements={ \"contractAddress\": \"0xContract\" })\n# resp is of type AuthResponse\nprint(resp.user)\nprint(resp.access_token)\n```\n\n## Validate\n`validate` validates an access token. `validate` should be called, or manually access token validation should be done, server-side before trusting a request's access token. It's common to move access token validation and decoding logic to a shared middleware across API endpoints.\nIf the access token is valid, validate returns the decoded claims of the access token.\n\n```python\nresp, err := picket.validate(access_token=\"xxx.yyy.zzz\", requirements={\"contractAddress\": \"0xContract\", \"minTokenBalance\": \"100\"})\n# Response is the decoded access token (AuthorizedUser)\nprint(resp)\n```\n\n## Verify Token Ownership\nIf you only want to verify token ownership server side for a given wallet, `tokenOwnership` allows you to do just that.\n\n```python\nresp = picket.token_ownership(\n\t\t\tchain=\"solana\", \n\t\t\twallet_address=\"waLLETaddRess\", \n\t\t\trequirements={  \n\t\t\t  \"collection\": \"METAPLEX_COLLECTION\",\n\t\t\t  \"minTokenBalance\": \"3\",\n\t\t\t}\n\t\t)\n# Response is of type TokenOwnershipResponse\nprint(resp.allowed)\nprint(resp.tokenBalances)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicketapi%2Fpicket-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpicketapi%2Fpicket-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicketapi%2Fpicket-python/lists"}