{"id":21214786,"url":"https://github.com/filestack/filestack-python","last_synced_at":"2025-04-09T12:05:13.822Z","repository":{"id":44706398,"uuid":"89370440","full_name":"filestack/filestack-python","owner":"filestack","description":"Official Python SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.","archived":false,"fork":false,"pushed_at":"2024-09-17T18:10:54.000Z","size":8729,"stargazers_count":49,"open_issues_count":5,"forks_count":21,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2025-04-02T08:13:11.369Z","etag":null,"topics":["hacktoberfest","python","sdk-python","transforming-files","upload-file","upload-images"],"latest_commit_sha":null,"homepage":"https://www.filestack.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filestack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2017-04-25T14:30:45.000Z","updated_at":"2024-12-06T12:28:16.000Z","dependencies_parsed_at":"2024-06-18T21:30:54.805Z","dependency_job_id":"33aeb6bf-aa6a-48d8-baaf-6871d8c7953f","html_url":"https://github.com/filestack/filestack-python","commit_stats":{"total_commits":326,"total_committers":14,"mean_commits":"23.285714285714285","dds":"0.45398773006134974","last_synced_commit":"98735ccc1a53ba4105df2d47a9c0458f6a7a24d6"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filestack%2Ffilestack-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filestack","download_url":"https://codeload.github.com/filestack/filestack-python/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"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":["hacktoberfest","python","sdk-python","transforming-files","upload-file","upload-images"],"created_at":"2024-11-20T21:30:57.890Z","updated_at":"2025-04-09T12:05:13.797Z","avatar_url":"https://github.com/filestack.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"logo.svg\" align=\"center\" width=\"100\"/\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eFilestack Python\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://img.shields.io/pypi/pyversions/filestack-python.svg\"\u003e\n    \u003cimg src=\"https://github.com/filestack/filestack-python/actions/workflows/tests.yml/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/filestack-python\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/filestack-python.svg\"\u003e\n  \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/filestack-python.svg\"\u003e\n\u003c/p\u003e\nThis is the official Python SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.\n\n## Resources\n\nTo learn more about this SDK, please visit our API Reference\n\n* [API Reference](https://filestack-python.readthedocs.io)\n\n## Installing\n\nInstall ``filestack`` with pip\n\n```shell\npip install filestack-python\n```\n\nor directly from GitHub\n\n```shell\npip install git+https://github.com/filestack/filestack-python.git\n```\n\n## Quickstart\n\nThe Filestack SDK allows you to upload and handle filelinks using two main classes: Client and Filelink.\n\n### Uploading files with `filestack.Client`\n``` python\nfrom filestack import Client\nclient = Client('\u003cYOUR_API_KEY\u003e')\n\nnew_filelink = client.upload(filepath='path/to/file')\nprint(new_filelink.url)\n```\n\n#### Uploading files using Filestack Intelligent Ingestion\nTo upload files using Filestack Intelligent Ingestion, simply add `intelligent=True` argument\n```python\nnew_filelink = client.upload(filepath='path/to/file', intelligent=True)\n```\nFII always uses multipart uploads. In case of network issues, it will dynamically split file parts into smaller chunks (sacrificing upload speed in favour of upload reliability).\n\n### Working with Filelinks\nFilelink objects can by created by uploading new files, or by initializing `filestack.Filelink` with already existing file handle\n```python\nfrom filestack import Filelink, Client\n\nclient = Client('\u003cAPIKEY\u003e')\nfilelink = client.upload(filepath='path/to/file')\nfilelink.url  # 'https://cdn.filestackcontent.com/FILE_HANDLE\n\n# work with previously uploaded file\nfilelink = Filelink('FILE_HANDLE')\n```\n\n### Basic Filelink Functions\n\nWith a Filelink, you can download to a local path or get the content of a file. You can also perform various transformations.\n\n```python\nfile_content = new_filelink.get_content()\n\nsize_in_bytes = new_filelink.download('/path/to/file')\n\nfilelink.overwrite(filepath='path/to/new/file')\n\nfilelink.resize(width=400).flip()\n\nfilelink.delete()\n```\n\n### Transformations\n\nYou can chain transformations on both Filelinks and external URLs. Storing transformations will return a new Filelink object.\n\n```python\ntransform = client.transform_external('http://\u003cSOME_URL\u003e')\nnew_filelink = transform.resize(width=500, height=500).flip().enhance().store()\n\nfilelink = Filelink('\u003cYOUR_HANDLE'\u003e)\nnew_filelink = filelink.resize(width=500, height=500).flip().enhance().store()\n```\n\nYou can also retrieve the transformation url at any point.\n\n ```python\ntransform_candidate = client.transform_external('http://\u003cSOME_URL\u003e')\ntransform = transform_candidate.resize(width=500, height=500).flip().enhance()\nprint(transform.url)\n```\n\n### Audio/Video Convert\n\nAudio and video conversion works just like any transformation, except it returns an instance of class AudioVisual, which allows you to check the status of your video conversion, as well as get its UUID and timestamp. \n\n```python\nav_object = filelink.av_convert(width=100, height=100)\nwhile (av_object.status != 'completed'):\n    print(av_object.status)\n    print(av_object.uuid)\n    print(av_object.timestamp)\n```\n\nThe status property makes a call to the API to check its current status, and you can call to_filelink() once video is complete (this function checks its status first and will fail if not completed yet).\n\n```python\nfilelink = av_object.to_filelink()\n```\n\n### Security Objects\n\nSecurity is set on Client or Filelink classes upon instantiation and is used to sign all API calls.\n\n```python\nfrom filestack import Security\n\npolicy = {'expiry': 253381964415}  # 'expiry' is the only required key\nsecurity = Security(policy, '\u003cYOUR_APP_SECRET\u003e')\nclient = Client('\u003cYOUR_API_KEY', security=security)\n\n# new Filelink object inherits security and will use for all calls\nnew_filelink = client.upload(filepath='path/to/file')\n\n# you can also provide Security objects explicitly for some methods\nsize_in_bytes = filelink.download(security=security)\n```\n\nYou can also retrieve security details straight from the object:\n```python\n\u003e\u003e\u003e policy = {'expiry': 253381964415, 'call': ['read']}\n\u003e\u003e\u003e security = Security(policy, 'SECURITY-SECRET')\n\u003e\u003e\u003e security.policy_b64\n'eyJjYWxsIjogWyJyZWFkIl0sICJleHBpcnkiOiAyNTMzODE5NjQ0MTV9'\n\u003e\u003e\u003e security.signature\n'f61fa1effb0638ab5b6e208d5d2fd9343f8557d8a0bf529c6d8542935f77bb3c'\n```\n\n### Webhook verification\n\nYou can use `filestack.helpers.verify_webhook_signature` method to make sure that the webhooks you receive are sent by Filestack.\n\n```python\nfrom filestack.helpers import verify_webhook_signature\n\n# webhook_data is raw content you receive\nwebhook_data = b'{\"action\": \"fp.upload\", \"text\": {\"container\": \"some-bucket\", \"url\": \"https://cdn.filestackcontent.com/Handle\", \"filename\": \"filename.png\", \"client\": \"Computer\", \"key\": \"key_filename.png\", \"type\": \"image/png\", \"size\": 1000000}, \"id\": 50006}'\n\nresult, details = verify_webhook_signature(\n    '\u003cYOUR_WEBHOOK_SECRET\u003e',\n    webhook_data,\n    {\n      'FS-Signature': '\u003cSIGNATURE-FROM-REQUEST-HEADERS\u003e',\n      'FS-Timestamp': '\u003cTIMESTAMP-FROM-REQUEST-HEADERS\u003e'\n    }\n)\n\nif result is True:\n    print('Webhook is valid and was generated by Filestack')\nelse:\n    raise Exception(details['error'])\n```\n\n## Versioning\n\nFilestack Python SDK follows the [Semantic Versioning](http://semver.org/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilestack%2Ffilestack-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilestack%2Ffilestack-python/lists"}