Skip to content

Commit

Permalink
Merge pull request #43 from dbrennand/1.1.0
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
dbrennand committed May 26, 2024
2 parents 68e8849 + aa9d7c5 commit ed564c3
Show file tree
Hide file tree
Showing 19 changed files with 565 additions and 680 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ on:
- push

jobs:
Test:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
id: setup-python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.12

- name: Load cached Poetry installation
uses: actions/cache@v2
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
Expand All @@ -31,7 +33,7 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: 3.12

- name: Load cached Poetry installation
uses: actions/cache@v2
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1

- name: Configure Poetry
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.1.0

* chore(deps): Update all dependencies.
* chore: update license year.

## 1.0.2

* chore(deps): Update all dependencies.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 dbrennand
Copyright (c) 2024 Daniel Brennand

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions examples/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
https://developers.virustotal.com/v2.0/reference/comments-get
https://developers.virustotal.com/v2.0/reference/comments-put
"""

from virustotal_python import Virustotal
from base64 import urlsafe_b64encode

Expand Down
1 change: 1 addition & 0 deletions examples/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* v3 documentation - https://developers.virustotal.com/reference/collections
"""

from virustotal_python import Virustotal

API_KEY = "<VirusTotal API Key>"
Expand Down
1 change: 1 addition & 0 deletions examples/domain_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* v2 documentation - https://developers.virustotal.com/v2.0/reference/domain-report
"""

from virustotal_python import Virustotal
from pprint import pprint

Expand Down
1 change: 1 addition & 0 deletions examples/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* v2 documentation - https://developers.virustotal.com/v2.0/reference/file-report
"""

from virustotal_python import Virustotal
from pprint import pprint

Expand Down
1 change: 1 addition & 0 deletions examples/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* v3 documentation - https://developers.virustotal.com/reference/graphs
"""

from virustotal_python import Virustotal

API_KEY = "<VirusTotal API Key>"
Expand Down
1 change: 1 addition & 0 deletions examples/ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* v2 documentation - https://developers.virustotal.com/v2.0/reference/ip-address-report
"""

from virustotal_python import Virustotal
from pprint import pprint

Expand Down
1 change: 1 addition & 0 deletions examples/old_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Examples for versions >=0.1.0 head to /examples directory.
"""

from virustotal_python import Virustotal
from pprint import pprint
import os.path
Expand Down
1 change: 1 addition & 0 deletions examples/scan_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* v2 documentation - https://developers.virustotal.com/v2.0/reference/file-scan
"""

from virustotal_python import Virustotal
import os.path
from pprint import pprint
Expand Down
1 change: 1 addition & 0 deletions examples/scan_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
https://developers.virustotal.com/v2.0/reference/url-scan
https://developers.virustotal.com/v2.0/reference/url-report
"""

from virustotal_python import Virustotal
from pprint import pprint
from base64 import urlsafe_b64encode
Expand Down
1 change: 1 addition & 0 deletions examples/searchmetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
https://developers.virustotal.com/reference/search-1
https://developers.virustotal.com/reference/metadata
"""

from virustotal_python import Virustotal

API_KEY = "<VirusTotal API Key>"
Expand Down
1,169 changes: 514 additions & 655 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "virustotal-python"
version = "1.0.2"
version = "1.1.0"
description = "A Python library to interact with the public VirusTotal v3 and v2 APIs."
authors = ["dbrennand"]
license = "MIT"
Expand All @@ -20,23 +20,27 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
exclude = [".gitignore"]

[tool.poetry.dependencies]
python = "^3.7"
requests = {version = "^2.26.0", extras = ["socks"]}
python = "^3.12"
requests = { version = "^2.31.0" }
PySocks = { version = "^1.7.1", optional = true }

[tool.poetry.extras]
socks = ["PySocks^1.7.1"]
socks = ["PySocks"]

[tool.poetry.dev-dependencies]
black = "22.3.0"
twine = "^3.5.0"
pytest = "^6.2.5"
pytest-mock = "^3.6.1"
requests-mock = "^1.9.3"
pytest-cov = "^3.0.0"
black = "^24.4.2"
twine = "^5.1.0"
pytest = "^8.2.0"
pytest-mock = "^3.14.0"
requests-mock = "^1.12.1"
pytest-cov = "^5.0.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
1 change: 1 addition & 0 deletions tests/test_virustotal_python.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for virustotal-python.
"""

import virustotal_python
import json
import requests
Expand Down
3 changes: 2 additions & 1 deletion virustotal_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""A Python library to interact with the public VirusTotal v3 and v2 APIs.
"""

from virustotal_python.virustotal import Virustotal
from virustotal_python.virustotal import VirustotalResponse
from virustotal_python.virustotal import VirustotalError
Expand All @@ -8,4 +9,4 @@

__all__ = ["Virustotal", "VirustotalResponse", "VirustotalError"]
__author__ = "dbrennand"
__version__ = "1.0.2"
__version__ = "1.1.0"
7 changes: 4 additions & 3 deletions virustotal_python/virustotal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2023 dbrennand
Copyright (c) 2024 Daniel Brennand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import requests
import os
from typing import Union
Expand Down Expand Up @@ -267,14 +268,14 @@ def __init__(
self.BASEURL = "https://www.virustotal.com/vtapi/v2/"
self.HEADERS = {
"Accept-Encoding": "gzip, deflate",
"User-Agent": f"gzip, virustotal-python 1.0.2",
"User-Agent": f"gzip, virustotal-python 1.1.0",
}
elif (API_VERSION == "v3") or (API_VERSION == 3):
self.API_VERSION = API_VERSION
self.BASEURL = "https://www.virustotal.com/api/v3/"
self.HEADERS = {
"Accept-Encoding": "gzip, deflate",
"User-Agent": f"gzip, virustotal-python 1.0.2",
"User-Agent": f"gzip, virustotal-python 1.1.0",
"x-apikey": f"{self.API_KEY}",
}
else:
Expand Down

0 comments on commit ed564c3

Please sign in to comment.