Skip to content

Commit 7fe37d1

Browse files
committed
📜 improve example + cleanup
1 parent cbb173a commit 7fe37d1

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

README.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,36 @@ pip install codeboxapi
1515
## Usage
1616

1717
```python
18-
from codeboxapi import CodeBox, set_api_key
18+
# Make sure to set the api-key as environment variable:
19+
# CODEBOX_API_KEY=sk-*******************************
1920

21+
from codeboxapi import CodeBox
2022

21-
set_api_key("sk-************************")
22-
# or put your api key inside the .env file
23-
# CODEBOX_API_KEY=your-api-key
2423

25-
# create and startup
26-
codebox = CodeBox()
27-
codebox.start()
24+
# startup and automatically shutdown a new codebox
25+
with CodeBox() as codebox:
26+
# check if it's running
27+
print(codebox.status())
2828

29-
# check if it's running
30-
print(str(codebox.status()) == "running")
29+
# run some code
30+
codebox.run("a = 'Hello'")
31+
codebox.run("b = 'World!'")
32+
codebox.run("result = a + ', ' + b")
33+
result = codebox.run("print(result)")
3134

32-
# run some code
33-
result = codebox.run("print('Hello, World!')")
35+
print(result)
36+
# Hello, World!
3437

35-
# print the result
36-
print(result)
37-
38-
codebox.stop()
3938
```
4039

4140
## Where to get your api-key?
4241

43-
CodeBox is currently in early development so I created a stripe payment link as login system:
44-
https://pay.codeboxapi.com/b/00g3e6dZX2fTg0gaEE
45-
As BetaTester you get 70% with the code `BETA`.
46-
Bear in mind, we don't have many automations set up right now,
47-
so you'll need to write an [email](mailto:[email protected]) for things like refunds,
42+
CodeBox is currently in early development so I created a stripe [payment link as login](https://pay.codeboxapi.com/b/00g3e6dZX2fTg0gaEE) system.
43+
As BetaTester you get 70% with the code `BETA`.
44+
Bear in mind, we don't have many automations set up right now,
45+
so you'll need to write an [email](mailto:[email protected]) for things like refunds,
4846
sub cancellations, or upgrades.
4947

50-
5148
## Contributing
5249

5350
Feel free to contribute to this project.
@@ -59,4 +56,4 @@ You can open an issue or submit a pull request.
5956

6057
## Contact
6158

62-
You can contact me at [pleurae-berets.0u@icloud.com](mailto:pleurae-berets.0u@icloud.com)
59+
You can contact me at [contact@codeboxapi.com](mailto:contact@codeboxapi.com)

0 commit comments

Comments
 (0)