# Step 2: Download and configure the sample code

You need to obtain app credentials, then download the sample code, and configure the app credentials in the corresponding sections of the code. Finally, configure the runtime environment for the sample code.

## Get app credentials
**The test version app and the official version app are two independent applications**. If you want to use the test version app for development purposes, all subsequent operations need to be performed in the test version app.

1. Click **Credentials & Basic Info** on the left navigation bar. Obtain the `App ID` and `App Secret` values in the **Credentials** section.

2. Click on the left navigation bar to enter the **Events & Callbacks** page, then enter the **Encryption Strategy** tab to obtain the `Verification Token` value.

## Download code samples and configure app credentials

1. Download and unzip the [demo example](https://sf3-cn.feishucdn.com/obj/open-platform-opendoc/5079d07daa862fb8dfdd8960429b830e.zip) using a local command-line tool, then navigate to the `python` directory.

For an explanation of the code logic in each module, refer to the [code sample introduction](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/configuration).

**Mac/** **Linux**
    ```
    curl https://sf3-cn.feishucdn.com/obj/open-platform-opendoc/5079d07daa862fb8dfdd8960429b830e.zip -o robot_quick_start.zip
    unzip robot_quick_start.zip
    cd robot_quick_start/python
    ```
    **Windows**
    ```
    curl https://sf3-cn.feishucdn.com/obj/open-platform-opendoc/5079d07daa862fb8dfdd8960429b830e.zip -o robot_quick_start.zip
    robot_quick_start.zip
    cd robot_quick_start/python
    ```

2. Open the `.env` file in the python folder.

This file is a hidden file. You can choose any of the following methods to open the file according to the actual development environment:
     - Method 1: Use a development tool (such as PyCharm) to open the python project and find the `.env` file.
     - Method 2: In the command line terminal, make sure you have entered the python directory, and then execute the `vi .env` command to open the file.

3. Modify the application credential data in the `.env` file to the actual application credential information.
    ```
    APP_ID=cli_9fxxxx00b
    APP_SECRET=EX6xxxxOF
    VERIFICATION_TOKEN=cq3xxxxxxkUS
    ```

## Start local service

You can choose any running mode of local or Docker container to start the backend service.

### Method 1: Run locally

1. Create and activate a new virtual environment.

**Windows**
    ```
    python3 -m venv venv
    venv\Scripts\activate
    ```
     **Mac/** **Linux**
    ```
    python3 -m venv venv
    . venv/bin/activate
    ```

After activation, the terminal will display the name of the virtual environment.

2. Install dependencies.
    ```
    pip3 install -r requirements.txt
    ```
    After the installation is successful, the following prompt will appear:

3. Run the service.

```
    python3 server.py
    ```

### Method 2: Docker running

If you have installed [Docker](https://www.docker.com/), you can run the Docker environment directly.

**Mac/** **Linux**
```
sh exec.sh
```
**Windows**
```
.\exec.ps1
```

