{"id":13618659,"url":"https://github.com/MTG/freesound-python","last_synced_at":"2025-04-14T13:31:32.077Z","repository":{"id":138311069,"uuid":"954509","full_name":"MTG/freesound-python","owner":"MTG","description":"python client for the freesound API","archived":false,"fork":false,"pushed_at":"2023-07-28T03:23:08.000Z","size":194,"stargazers_count":131,"open_issues_count":8,"forks_count":36,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-08T04:38:26.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/MTG.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2010-10-01T15:32:55.000Z","updated_at":"2024-10-21T11:13:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec775166-2a72-4938-a605-72efe300170e","html_url":"https://github.com/MTG/freesound-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/MTG%2Ffreesound-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MTG%2Ffreesound-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MTG%2Ffreesound-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MTG%2Ffreesound-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MTG","download_url":"https://codeload.github.com/MTG/freesound-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888670,"owners_count":21178092,"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-08-01T21:00:28.347Z","updated_at":"2025-04-14T13:31:31.704Z","avatar_url":"https://github.com/MTG.png","language":"Python","readme":"freesound.py\n============\n\nA Python client for the [Freesound](https://freesound.org) APIv2.\n\nFind the API documentation at http://www.freesound.org/docs/api/. \nApply for an API key at https://www.freesound.org/apiv2/apply/. \n\nThe client automatically maps function arguments to http parameters of the API. \nJSON results are converted to python objects, but are also available in their original form (JSON loaded into dictionaries) using the method `.as_dict()` of returned objets (see [examples file](https://github.com/MTG/freesound-python/blob/master/examples.py)). \nThe main object types (`Sound`, `User`, `Pack`) are augmented with the corresponding API calls.\n\nNote that POST resources are not supported. Downloading full quality sounds requires Oauth2 authentication (see https://freesound.org/docs/api/authentication.html). Oauth2 authentication is supported by passing an access token, but you are expected to implement the workflow to obtain that access token. Here is an [example implementation of the Freesound OAuth2 workflow using Flask](https://gist.github.com/ffont/3607ba4af9814f3877cd42894a564222).\n\nExample usage:\n\n```python\nimport freesound\n\nclient = freesound.FreesoundClient()\nclient.set_token(\"\u003cyour_api_key\u003e\",\"token\")\n\nresults = client.text_search(query=\"dubstep\",fields=\"id,name,previews\")\n\nfor sound in results:\n    sound.retrieve_preview(\".\",sound.name+\".mp3\")\n    print(sound.name)\n\n```\n\n## Installation\n1) clone or download\n\n2) run:\n```\npython setup.py install\n```\n\nAlternatively you should also be able to install directly from GitHub with:\n```\npip install git+https://github.com/MTG/freesound-python\n```\n\n## Advanced usage\n\n### Modifying the requests' session:\n\nYou can easily extend/modify the way how requests are done by interacting directly with\nthe session object of the client.\n\nFor example, adding proxies:\n```python\nproxies = {\n  'http': 'http://10.10.1.10:3128',\n  'https': 'http://10.10.1.10:1080',\n}\nclient.session.proxies.update(proxies)\n```\n\nor adding [rate limiting](https://github.com/JWCook/requests-ratelimiter):\n```python\nfrom requests_ratelimiter import LimiterSession\n\n# Apply a rate-limit (59 requests per minute) to all requests\nclient.session = LimiterSession(per_minute=59)\n```\n\n### Authenticating with OAuth\nHere is an example authentication flow with the help of [Requests-OAuthlib](https://requests-oauthlib.readthedocs.io/).\n```python\nfrom requests_oauthlib import OAuth2Session\n\nimport freesound\n\nclient_id = \"\u003cyour_client_id\u003e\"\nclient_secret = \"\u003cyour_client_secret\u003e\"\n\n# do the OAuth dance\noauth = OAuth2Session(client_id)\n\nauthorization_url, state = oauth.authorization_url(\n    \"https://freesound.org/apiv2/oauth2/authorize/\"\n)\nprint(f\"Please go to {authorization_url} and authorize access.\")\n\nauthorization_code = input(\"Please enter the authorization code:\")\noauth_token = oauth.fetch_token(\n    \"https://freesound.org/apiv2/oauth2/access_token/\",\n    authorization_code,\n    client_secret=client_secret,\n)\n\nclient = freesound.FreesoundClient()\nclient.set_token(oauth_token[\"access_token\"], \"oauth\")\n```\n","funding_links":[],"categories":["Playback \u0026 Services","Python"],"sub_categories":["Text-to-Speech"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMTG%2Ffreesound-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMTG%2Ffreesound-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMTG%2Ffreesound-python/lists"}