Python

Prerequisites

    Install CLI​
    Python version 3.5 or higher
    pip installed
    All project dependencies installed
      pip install -r requirements.txt

Command-line

Run the following command line by setting your parameters.
1
cdefense scan --lang=python --api-key=<YOUR_API_KEY> \
2
--path=/d/temp/vulpy --project-name="my-python-project"
Copied!

Gitlab Integration

1
image: "python:3.7"
2
​
3
before_script:
4
- python --version
5
- pip install -r requirements.txt
6
​
7
stages:
8
- Test
9
​
10
pytest:
11
stage: Test
12
script:
13
- curl https://raw.githubusercontent.com/CloudDefenseAI/cd/master/latest/cd-latest-linux-x64.tar.gz > /tmp/cd-latest-linux-x64.tar.gz && tar -C /usr/local/bin -xzf /tmp/cd-latest-linux-x64.tar.gz && chmod +x /usr/local/bin/cdefense
14
- cdefense scan --lang=python --project-name=python-sample-project --api-key=<YOUR_API_KEY> --path=requirements.txt
15
- echo $?
Copied!

​

​
Last modified 1mo ago