Skip to content

Commit c5e8f35

Browse files
authored
Merge pull request #533 from AffanShaikhsurab/patch-3
Add instructions for running API Dash code in Python using requests across macOS, Windows, and Linux
2 parents 7c451e1 + cb07ee7 commit c5e8f35

File tree

1 file changed

+84
-1
lines changed

1 file changed

+84
-1
lines changed

Diff for: doc/user_guide/instructions_to_run_generated_code.md

+84-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,90 @@ TODO
115115

116116
## Python (requests)
117117

118-
TODO
118+
Here are the detailed instructions for running the generated API Dash code in Python (using `requests`) for macOS, Windows, and Linux:
119+
120+
### 1. Install Python:
121+
#### macOS:
122+
- Go to the official Python website: [https://www.python.org/downloads/macos/](https://www.python.org/downloads/macos/)
123+
- Download the latest version for macOS and follow the installation instructions.
124+
125+
#### Windows:
126+
- Go to the official Python website: [https://www.python.org/downloads/](https://www.python.org/downloads/)
127+
- Download the latest version for Windows and run the installer. During installation, make sure to check the box that says "Add Python to PATH."
128+
129+
#### Linux:
130+
- Most Linux distributions come with Python pre-installed. To check if Python is already installed, open the terminal and type:
131+
132+
```bash
133+
python3 --version
134+
```
135+
136+
- If it's not installed, you can install it via your package manager:
137+
- On Ubuntu/Debian-based systems:
138+
139+
```bash
140+
sudo apt update
141+
sudo apt install python3
142+
```
143+
144+
- On Fedora/CentOS-based systems:
145+
146+
```bash
147+
sudo dnf install python3
148+
```
149+
150+
### 2. Install the `requests` library:
151+
#### macOS and Linux:
152+
Open the terminal and type the following command to install the `requests` library using `pip`:
153+
154+
```bash
155+
pip3 install requests
156+
```
157+
158+
#### Windows:
159+
Open Command Prompt (or PowerShell) and type the following command to install the `requests` library using `pip`:
160+
161+
```bash
162+
pip install requests
163+
```
164+
165+
### 3. Execute the generated code:
166+
Once you have Python and `requests` installed, follow these steps to execute the generated code:
167+
168+
1. **Open a text editor** ✍️ (like Notepad on Windows, TextEdit on macOS, or any code editor like Visual Studio Code).
169+
2. **Copy the generated code** 📋 from API Dash.
170+
3. **Paste the code** into the text editor 🔄.
171+
4. **Save the file** 💾 with a `.py` extension, such as `api_test.py`.
172+
173+
This makes the steps a little more visual and fun!
174+
175+
#### macOS and Linux:
176+
1. Open the **Terminal**.
177+
2. **Navigate to the directory** where you saved the `.py` file. For example:
178+
179+
```bash
180+
cd /path/to/your/file
181+
```
182+
183+
3. **Run the Python script** by typing the following command:
184+
185+
```bash
186+
python3 api_test.py
187+
```
188+
189+
#### Windows:
190+
1. Open **Command Prompt** (or PowerShell).
191+
2. **Navigate to the directory** where you saved the `.py` file. For example:
192+
193+
```bash
194+
cd C:\path\to\your\file
195+
```
196+
197+
3. **Run the Python script** by typing the following command:
198+
199+
```bash
200+
python api_test.py
201+
```
119202

120203
## Python (http.client)
121204

0 commit comments

Comments
 (0)