Filebase
Search…
Code Examples
This page showcases a variety of app examples using Filebase with programming languages.
The Filebase GitHub page contains example code for apps using Filebase, as well as a variety of other projects using frameworks such as Ruby on Rails, JSON-RPC and others.
Check out the GitHub page here:
Filebase
GitHub
Below are code examples for NodeJS, PHP, and Python.
NodeJS
PHP
Python
GitHub - filebase/nodejs-example
GitHub

Quick Start

Use the following commands to get started:
1
git clone https://github.com/filebase/nodejs-example && cd nodejs-example
2
npm ci
3
AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret node app.js
Copied!

Manual Start

Create files with the following names and contents to manually recreate this example:
app.js
1
var AWS = require('aws-sdk');
2
var s3 = new AWS.S3({endpoint: 'https://s3.filebase.com', signatureVersion: 'v4'});
3
4
s3.listBuckets(function(err, data) {
5
if (err) {
6
console.log(err, err.stack);
7
} else {
8
var params = {
9
Body: 'Hello, world!',
10
Bucket: data['Buckets'][0]['Name'],
11
Key: 'exampleobject',
12
ContentType: 'text/plain',
13
Metadata: {
14
'metadata1': 'value1',
15
'metadata2': 'value2'
16
}
17
};
18
s3.putObject(params, function(err, data) {
19
if (err) {
20
console.log(err, err.stack);
21
} else {
22
console.log(data);
23
}
24
});
25
}
26
});
Copied!
package.json
1
{
2
"name": "nodejs-example",
3
"version": "1.0.0",
4
"description": "An example project demonstrating how to use Filebase with NodeJS",
5
"main": "index.js",
6
"scripts": {
7
"test": "echo \"Error: no test specified\" && exit 1"
8
},
9
"author": "Filebase <[email protected]>",
10
"license": "ISC",
11
"dependencies": {
12
"aws-sdk": "^2.580.0"
13
}
14
}json
Copied!
package-lock.json
1
{
2
"name": "nodejs-example",
3
"version": "1.0.0",
4
"lockfileVersion": 1,
5
"requires": true,
6
"dependencies": {
7
"aws-sdk": {
8
"version": "2.580.0",
9
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.580.0.tgz",
10
"integrity": "sha512-YUn/LgaSjWuFDCAIOiOvyXbuRpNEzTPLbwRs3GpEmrP1hJrOChXh0p7GH61sTZdeJZarCSETUOWU5ngjpCOjKA==",
11
"requires": {
12
"buffer": "^4.9.1",
13
"events": "^1.1.1",
14
"ieee754": "^1.1.13",
15
"jmespath": "^0.15.0",
16
"querystring": "^0.2.0",
17
"sax": "^1.2.1",
18
"url": "^0.10.3",
19
"uuid": "^3.3.2",
20
"xml2js": "^0.4.19"
21
}
22
},
23
"base64-js": {
24
"version": "1.3.1",
25
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
26
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
27
},
28
"buffer": {
29
"version": "4.9.2",
30
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
31
"integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
32
"requires": {
33
"base64-js": "^1.0.2",
34
"ieee754": "^1.1.4",
35
"isarray": "^1.0.0"
36
}
37
},
38
"define-properties": {
39
"version": "1.1.3",
40
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
41
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
42
"requires": {
43
"object-keys": "^1.0.12"
44
}
45
},
46
"es-abstract": {
47
"version": "1.16.2",
48
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.2.tgz",
49
"integrity": "sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA==",
50
"requires": {
51
"es-to-primitive": "^1.2.1",
52
"function-bind": "^1.1.1",
53
"has": "^1.0.3",
54
"has-symbols": "^1.0.1",
55
"is-callable": "^1.1.4",
56
"is-regex": "^1.0.4",
57
"object-inspect": "^1.7.0",
58
"object-keys": "^1.1.1",
59
"string.prototype.trimleft": "^2.1.0",
60
"string.prototype.trimright": "^2.1.0"
61
}
62
},
63
"es-to-primitive": {
64
"version": "1.2.1",
65
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
66
"integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
67
"requires": {
68
"is-callable": "^1.1.4",
69
"is-date-object": "^1.0.1",
70
"is-symbol": "^1.0.2"
71
}
72
},
73
"events": {
74
"version": "1.1.1",
75
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
76
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
77
},
78
"function-bind": {
79
"version": "1.1.1",
80
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
81
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
82
},
83
"has": {
84
"version": "1.0.3",
85
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
86
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
87
"requires": {
88
"function-bind": "^1.1.1"
89
}
90
},
91
"has-symbols": {
92
"version": "1.0.1",
93
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
94
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
95
},
96
"ieee754": {
97
"version": "1.1.13",
98
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
99
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
100
},
101
"is-callable": {
102
"version": "1.1.4",
103
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz",
104
"integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA=="
105
},
106
"is-date-object": {
107
"version": "1.0.1",
108
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
109
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY="
110
},
111
"is-regex": {
112
"version": "1.0.4",
113
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
114
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
115
"requires": {
116
"has": "^1.0.1"
117
}
118
},
119
"is-symbol": {
120
"version": "1.0.3",
121
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
122
"integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
123
"requires": {
124
"has-symbols": "^1.0.1"
125
}
126
},
127
"isarray": {
128
"version": "1.0.0",
129
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
130
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
131
},
132
"jmespath": {
133
"version": "0.15.0",
134
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz",
135
"integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc="
136
},
137
"object-inspect": {
138
"version": "1.7.0",
139
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
140
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw=="
141
},
142
"object-keys": {
143
"version": "1.1.1",
144
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
145
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
146
},
147
"object.getownpropertydescriptors": {
148
"version": "2.0.3",
149
"resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
150
"integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
151
"requires": {
152
"define-properties": "^1.1.2",
153
"es-abstract": "^1.5.1"
154
}
155
},
156
"punycode": {
157
"version": "1.3.2",
158
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
159
"integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
160
},
161
"querystring": {
162
"version": "0.2.0",
163
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
164
"integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
165
},
166
"sax": {
167
"version": "1.2.4",
168
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
169
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
170
},
171
"string.prototype.trimleft": {
172
"version": "2.1.0",
173
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
174
"integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
175
"requires": {
176
"define-properties": "^1.1.3",
177
"function-bind": "^1.1.1"
178
}
179
},
180
"string.prototype.trimright": {
181
"version": "2.1.0",
182
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
183
"integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
184
"requires": {
185
"define-properties": "^1.1.3",
186
"function-bind": "^1.1.1"
187
}
188
},
189
"url": {
190
"version": "0.10.3",
191
"resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz",
192
"integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=",
193
"requires": {
194
"punycode": "1.3.2",
195
"querystring": "0.2.0"
196
}
197
},
198
"util.promisify": {
199
"version": "1.0.0",
200
"resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
201
"integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
202
"requires": {
203
"define-properties": "^1.1.2",
204
"object.getownpropertydescriptors": "^2.0.3"
205
}
206
},
207
"uuid": {
208
"version": "3.3.3",
209
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
210
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
211
},
212
"xml2js": {
213
"version": "0.4.22",
214
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.22.tgz",
215
"integrity": "sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==",
216
"requires": {
217
"sax": ">=0.6.0",
218
"util.promisify": "~1.0.0",
219
"xmlbuilder": "~11.0.0"
220
}
221
},
222
"xmlbuilder": {
223
"version": "11.0.1",
224
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
225
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
226
}
227
}
228
}
Copied!
Run the following commands to use these files to run the example app:
1
npm ci
2
AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret node app.js
Copied!
GitHub - filebase/php-example
GitHub

Quick Start

Use the following commands to get started:
1
git clone [email protected]:filebase/php-example.git && cd php-example
2
docker run --rm -i -v $PWD:/app composer install
3
docker run --rm -i -v $PWD:/app -e AWS_ACCESS_KEY_ID=your_key -e AWS_SECRET_ACCESS_KEY=your_secret -w /app php:7.4-cli php index.php
Copied!

Manual Start

Create files with the following names and contents to manually recreate this example:
index.php
1
<?php
2
require 'vendor/autoload.php';
3
4
$s3 = new Aws\S3\S3Client([
5
'version' => '2006-03-01',
6
'region' => 'us-east-1',
7
'signature_version' => 'v4',
8
'endpoint' => 'https://s3.filebase.com'
9
]);
10
11
$buckets = $s3->listBuckets();
12
foreach ($buckets['Buckets'] as $bucket) {
13
echo $bucket['Name'] . "\n";
14
}
15
?>
Copied!
composer.json
1
{
2
"require": {
3
"aws/aws-sdk-php": "^3.155"
4
}
5
}
Copied!
composer.lock
1
{
2
"_readme": [
3
"This file locks the dependencies of your project to a known state",
4
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
"This file is @generated automatically"
6
],
7
"content-hash": "8efc941ba8e17df9954ace721f0e1325",
8
"packages": [
9
{
10
"name": "aws/aws-sdk-php",
11
"version": "3.155.3",
12
"source": {
13
"type": "git",
14
"url": "https://github.com/aws/aws-sdk-php.git",
15
"reference": "da40d5d22acbe542f37c44c78ee520005a6c81a2"
16
},
17
"dist": {
18
"type": "zip",
19
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/da40d5d22acbe542f37c44c78ee520005a6c81a2",
20
"reference": "da40d5d22acbe542f37c44c78ee520005a6c81a2",
21
"shasum": ""
22
},
23
"require": {
24
"ext-json": "*",
25
"ext-pcre": "*",
26
"ext-simplexml": "*",
27
"guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0",
28
"guzzlehttp/promises": "^1.0",
29
"guzzlehttp/psr7": "^1.4.1",
30
"mtdowling/jmespath.php": "^2.5",
31
"php": ">=5.5"
32
},
33
"require-dev": {
34
"andrewsville/php-token-reflection": "^1.4",
35
"aws/aws-php-sns-message-validator": "~1.0",
36
"behat/behat": "~3.0",
37
"doctrine/cache": "~1.4",
38
"ext-dom": "*",
39
"ext-openssl": "*",
40
"ext-pcntl": "*",
41
"ext-sockets": "*",
42
"nette/neon": "^2.3",
43
"paragonie/random_compat": ">= 2",
44
"phpunit/phpunit": "^4.8.35|^5.4.3",
45
"psr/cache": "^1.0",
46
"psr/simple-cache": "^1.0",
47
"sebastian/comparator": "^1.2.3"
48
},
49
"suggest": {
50
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications",
51
"doctrine/cache": "To use the DoctrineCacheAdapter",
52
"ext-curl": "To send requests using cURL",
53
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
54
"ext-sockets": "To use client-side monitoring"
55
},
56
"type": "library",
57
"extra": {
58
"branch-alias": {
59
"dev-master": "3.0-dev"
60
}
61
},
62
"autoload": {
63
"psr-4": {
64
"Aws\\": "src/"
65
},
66
"files": [
67
"src/functions.php"
68
]
69
},
70
"notification-url": "https://packagist.org/downloads/",
71
"license": [
72
"Apache-2.0"
73
],
74
"authors": [
75
{
76
"name": "Amazon Web Services",
77
"homepage": "http://aws.amazon.com"
78
}
79
],
80
"description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
81
"homepage": "http://aws.amazon.com/sdkforphp",
82
"keywords": [
83
"amazon",
84
"aws",
85
"cloud",
86
"dynamodb",
87
"ec2",
88
"glacier",
89
"s3",
90
"sdk"
91
],
92
"time": "2020-09-25T18:12:28+00:00"
93
},
94
{
95
"name": "guzzlehttp/guzzle",
96
"version": "7.1.0",
97
"source": {
98
"type": "git",
99
"url": "https://github.com/guzzle/guzzle.git",
100
"reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26"
101
},
102
"dist": {
103
"type": "zip",
104
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7edeaa528fbb57123028bd5a76b9ce9540194e26",
105
"reference": "7edeaa528fbb57123028bd5a76b9ce9540194e26",
106
"shasum": ""
107
},
108
"require": {
109
"ext-json": "*",
110
"guzzlehttp/promises": "^1.0",
111
"guzzlehttp/psr7": "^1.6.1",
112
"php": "^7.2.5",
113
"psr/http-client": "^1.0"
114
},
115
"provide": {
116
"psr/http-client-implementation": "1.0"
117
},
118
"require-dev": {
119
"ext-curl": "*",
120
"php-http/client-integration-tests": "dev-phpunit8",
121
"phpunit/phpunit": "^8.5.5",
122
"psr/log": "^1.1"
123
},
124
"suggest": {
125
"ext-curl": "Required for CURL handler support",
126
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
127
"psr/log": "Required for using the Log middleware"
128
},
129
"type": "library",
130
"extra": {
131
"branch-alias": {
132
"dev-master": "7.1-dev"
133
}
134
},
135
"autoload": {
136
"psr-4": {
137
"GuzzleHttp\\": "src/"
138
},
139
"files": [
140
"src/functions_include.php"
141
]
142
},
143
"notification-url": "https://packagist.org/downloads/",
144
"license": [
145
"MIT"
146
],
147
"authors": [
148
{
149
"name": "Michael Dowling",
150
"email": "[email protected]",
151
"homepage": "https://github.com/mtdowling"
152
},
153
{
154
"name": "Márk Sági-Kazár",
155
"email": "[email protected]",
156
"homepage": "https://sagikazarmark.hu"
157
}
158
],
159
"description": "Guzzle is a PHP HTTP client library",
160
"homepage": "http://guzzlephp.org/",
161
"keywords": [
162
"client",
163
"curl",
164
"framework",
165
"http",
166
"http client",
167
"psr-18",
168
"psr-7",
169
"rest",
170
"web service"
171
],
172
"funding": [
173
{
174
"url": "https://github.com/GrahamCampbell",
175
"type": "github"
176
},
177
{
178
"url": "https://github.com/Nyholm",
179
"type": "github"
180
},
181
{
182
"url": "https://github.com/alexeyshockov",
183
"type": "github"
184
},
185
{
186
"url": "https://github.com/gmponos",
187
"type": "github"
188
}
189
],
190
"time": "2020-09-22T09:10:04+00:00"
191
},
192
{
193
"name": "guzzlehttp/promises",
194
"version": "v1.3.1",
195
"source": {
196
"type": "git",
197
"url": "https://github.com/guzzle/promises.git",
198
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
199
},
200
"dist": {
201
"type": "zip",
202
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
203
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
204
"shasum": ""
205
},
206
"require": {
207
"php": ">=5.5.0"
208
},
209
"require-dev": {
210
"phpunit/phpunit": "^4.0"
211
},
212
"type": "library",
213
"extra": {
214
"branch-alias": {
215
"dev-master": "1.4-dev"
216
}
217
},
218
"autoload": {
219
"psr-4": {
220
"GuzzleHttp\\Promise\\": "src/"
221
},
222
"files": [
223
"src/functions_include.php"
224
]
225
},
226
"notification-url": "https://packagist.org/downloads/",
227
"license": [
228
"MIT"
229
],
230
"authors": [
231
{
232
"name": "Michael Dowling",
233
"email": "[email protected]",
234
"homepage": "https://github.com/mtdowling"
235
}
236
],
237
"description": "Guzzle promises library",
238
"keywords": [
239
"promise"
240
],
241
"time": "2016-12-20T10:07:11+00:00"
242
},
243
{
244
"name": "guzzlehttp/psr7",
245
"version": "1.6.1",
246
"source": {
247
"type": "git",
248
"url": "https://github.com/guzzle/psr7.git",
249
"reference": "239400de7a173fe9901b9ac7c06497751f00727a"
250
},
251
"dist": {
252
"type": "zip",
253
"url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
254
"reference": "239400de7a173fe9901b9ac7c06497751f00727a",
255
"shasum": ""
256
},
257
"require": {
258
"php": ">=5.4.0",
259
"psr/http-message": "~1.0",
260
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
261
},
262
"provide": {
263
"psr/http-message-implementation": "1.0"
264
},
265
"require-dev": {
266
"ext-zlib": "*",
267
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
268
},
269
"suggest": {
270
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
271
},
272
"type": "library",
273
"extra": {
274
"branch-alias": {
275
"dev-master": "1.6-dev"
276
}
277
},
278
"autoload": {
279
"psr-4": {
280
"GuzzleHttp\\Psr7\\": "src/"
281
},
282
"files": [
283
"src/functions_include.php"
284
]
285
},
286
"notification-url": "https://packagist.org/downloads/",
287
"license": [
288
"MIT"
289
],
290
"authors": [
291
{
292
"name": "Michael Dowling",
293
"email": "[email protected]",
294
"homepage": "https://github.com/mtdowling"
295
},
296
{
297
"name": "Tobias Schultze",
298
"homepage": "https://github.com/Tobion"
299
}
300
],
301
"description": "PSR-7 message implementation that also provides common utility methods",
302
"keywords": [
303
"http",
304
"message",
305
"psr-7",
306
"request",
307
"response",
308
"stream",
309
"uri",
310
"url"
311
],
312
"time": "2019-07-01T23:21:34+00:00"
313
},
314
{
315
"name": "mtdowling/jmespath.php",
316
"version": "2.6.0",
317
"source": {
318
"type": "git",
319
"url": "https://github.com/jmespath/jmespath.php.git",
320
"reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb"
321
},
322
"dist": {
323
"type": "zip",
324
"url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/42dae2cbd13154083ca6d70099692fef8ca84bfb",
325
"reference": "42dae2cbd13154083ca6d70099692fef8ca84bfb",
326
"shasum": ""
327
},
328
"require": {
329
"php": "^5.4 || ^7.0 || ^8.0",
330
"symfony/polyfill-mbstring": "^1.17"
331
},
332
"require-dev": {
333
"composer/xdebug-handler": "^1.4",
334
"phpunit/phpunit": "^4.8.36 || ^7.5.15"
335
},
336
"bin": [
337
"bin/jp.php"
338
],
339
"type": "library",
340
"extra": {
341
"branch-alias": {
342
"dev-master": "2.6-dev"
343
}
344
},
345
"autoload": {
346
"psr-4": {
347
"JmesPath\\": "src/"
348
},
349
"files": [
350
"src/JmesPath.php"
351
]
352
},
353
"notification-url": "https://packagist.org/downloads/",
354
"license": [
355
"MIT"
356
],
357
"authors": [
358
{
359
"name": "Michael Dowling",
360
"email": "[email protected]",
361
"homepage": "https://github.com/mtdowling"
362
}
363
],
364
"description": "Declaratively specify how to extract elements from a JSON document",
365
"keywords": [
366
"json",
367
"jsonpath"
368
],
369
"time": "2020-07-31T21:01:56+00:00"
370
},
371
{
372
"name": "psr/http-client",
373
"version": "1.0.1",
374
"source": {
375
"type": "git",
376
"url": "https://github.com/php-fig/http-client.git",
377
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
378
},
379
"dist": {
380
"type": "zip",
381
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
382
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
383
"shasum": ""
384
},
385
"require": {
386
"php": "^7.0 || ^8.0",
387
"psr/http-message": "^1.0"
388
},
389
"type": "library",
390
"extra": {
391
"branch-alias": {
392
"dev-master": "1.0.x-dev"
393
}
394
},
395
"autoload": {
396
"psr-4": {
397
"Psr\\Http\\Client\\": "src/"
398
}
399
},
400
"notification-url": "https://packagist.org/downloads/",
401
"license": [
402
"MIT"
403
],
404
"authors": [
405
{
406
"name": "PHP-FIG",
407
"homepage": "http://www.php-fig.org/"
408
}
409
],
410
"description": "Common interface for HTTP clients",
411
"homepage": "https://github.com/php-fig/http-client",
412
"keywords": [
413
"http",
414
"http-client",
415
"psr",
416
"psr-18"
417
],
418
"time": "2020-06-29T06:28:15+00:00"
419
},
420
{
421
"name": "psr/http-message",
422
"version": "1.0.1",
423
"source": {
424
"type": "git",
425
"url": "https://github.com/php-fig/http-message.git",
426
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
427
},
428
"dist": {
429
"type": "zip",
430
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
431
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
432
"shasum": ""
433
},
434
"require": {
435
"php": ">=5.3.0"
436
},
437
"type": "library",
438
"extra": {
439
"branch-alias": {
440
"dev-master": "1.0.x-dev"
441
}
442
},
443
"autoload": {
444
"psr-4": {
445
"Psr\\Http\\Message\\": "src/"
446
}
447
},
448
"notification-url": "https://packagist.org/downloads/",
449
"license": [
450
"MIT"
451
],
452
"authors": [
453
{
454
"name": "PHP-FIG",
455
"homepage": "http://www.php-fig.org/"
456
}
457
],
458
"description": "Common interface for HTTP messages",
459
"homepage": "https://github.com/php-fig/http-message",
460
"keywords": [
461
"http",
462
"http-message",
463
"psr",
464
"psr-7",
465
"request",
466
"response"
467
],
468
"time": "2016-08-06T14:39:51+00:00"
469
},
470
{
471
"name": "ralouphie/getallheaders",
472
"version": "3.0.3",
473
"source": {
474
"type": "git",
475
"url": "https://github.com/ralouphie/getallheaders.git",
476
"reference": "120b605dfeb996808c31b6477290a714d356e822"
477
},
478
"dist": {
479
"type": "zip",
480
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
481
"reference": "120b605dfeb996808c31b6477290a714d356e822",
482
"shasum": ""
483
},
484
"require": {
485
"php": ">=5.6"
486
},
487
"require-dev": {
488
"php-coveralls/php-coveralls": "^2.1",
489
"phpunit/phpunit": "^5 || ^6.5"
490
},
491
"type": "library",
492
"autoload": {
493
"files": [
494
"src/getallheaders.php"
495
]
496
},
497
"notification-url": "https://packagist.org/downloads/",
498
"license": [
499
"MIT"
500
],
501
"authors": [
502
{
503
"name": "Ralph Khattar",
504
"email": "[email protected]"
505
}
506
],
507
"description": "A polyfill for getallheaders.",
508
"time": "2019-03-08T08:55:37+00:00"
509
},
510
{
511
"name": "symfony/polyfill-mbstring",
512
"version": "v1.18.1",
513
"source": {
514
"type": "git",
515
"url": "https://github.com/symfony/polyfill-mbstring.git",
516
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
517
},
518
"dist": {
519
"type": "zip",
520
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
521
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
522
"shasum": ""
523
},
524
"require": {
525
"php": ">=5.3.3"
526
},
527
"suggest": {
528
"ext-mbstring": "For best performance"
529
},
530
"type": "library",
531
"extra": {
532
"branch-alias": {
533
"dev-master": "1.18-dev"
534
},
535
"thanks": {
536
"name": "symfony/polyfill",
537
"url": "https://github.com/symfony/polyfill"
538
}
539
},
540
"autoload": {
541
"psr-4": {
542
"Symfony\\Polyfill\\Mbstring\\": ""
543
},
544
"files": [
545
"bootstrap.php"
546
]
547
},
548
"notification-url": "https://packagist.org/downloads/",
549
"license": [
550
"MIT"
551
],
552
"authors": [
553
{
554
"name": "Nicolas Grekas",
555
"email": "[email protected]"
556
},
557
{
558
"name": "Symfony Community",
559
"homepage": "https://symfony.com/contributors"
560
}
561
],
562
"description": "Symfony polyfill for the Mbstring extension",
563
"homepage": "https://symfony.com",
564
"keywords": [
565
"compatibility",
566
"mbstring",
567
"polyfill",
568
"portable",
569
"shim"
570
],
571
"funding": [
572
{
573
"url": "https://symfony.com/sponsor",
574
"type": "custom"
575
},
576
{
577
"url": "https://github.com/fabpot",
578
"type": "github"
579
},
580
{
581
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
582
"type": "tidelift"
583
}
584
],
585
"time": "2020-07-14T12:35:20+00:00"
586
}
587
],
588
"packages-dev": [],
589
"aliases": [],
590
"minimum-stability": "stable",
591
"stability-flags": [],
592
"prefer-stable": false,
593
"prefer-lowest": false,
594
"platform": [],
595
"platform-dev": [],
596
"plugin-api-version": "1.1.0"
597
}
Copied!
Run the following commands to use these files to run the example app:
1
docker run --rm -i -v $PWD:/app composer install
2
docker run --rm -i -v $PWD:/app -e AWS_ACCESS_KEY_ID=your_key -e AWS_SECRET_ACCESS_KEY=your_secret -w /app php:7.4-cli php index.php
Copied!
GitHub - filebase/python-example
GitHub

Quick Start

Use the following commands to get started:
1
git clone https://github.com/filebase/python-example && cd python-example
2
pip3 install -r requirements.txt
3
AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret python3 app.py
Copied!

Manual Start

Create files with the following names and contents to manually recreate this example:
app.py
1
import os
2
import boto3
3
import logging
4
from pprint import pprint
5
6
from botocore.config import Config
7
from botocore.exceptions import ClientError
8
9
boto_config = Config(
10
region_name = 'us-east-1',
11
signature_version = 's3v4',
12
)
13
14
s3 = boto3.client('s3',
15
endpoint_url='https://s3.filebase.com',
16
aws_access_key_id=os.getenv('AWS_ACCESS_KEY_ID'),
17
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
18
config=boto_config)
19
20
response = s3.list_buckets()
21
pprint(response)