Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
USERNAME = "admin2"
PASSWORD = "not-very-secret"
APIURL = "" # no trailing slash
# create project
r ="{}/project/".format(APIURL), data={"name": PROJECT_NAME}, auth=(USERNAME, PASSWORD))
if r.status_code not in [200, 201, 202]:
raise Exception("something went wrong: {} ({})".format(r.text, r.status_code))
# upload file to project
files = {'file': open('/tmp/foobar2/dummy4.txt', 'rb')}
r ="{}/project/{}/malware/upload/".format(APIURL, PROJECT_NAME), files=files, auth=(USERNAME, PASSWORD))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment