Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Group POST (Documentation exemple) don't work in python ... #42

Open
Lvdl-sec opened this issue Jul 11, 2024 · 0 comments
Open

Basic Group POST (Documentation exemple) don't work in python ... #42

Lvdl-sec opened this issue Jul 11, 2024 · 0 comments

Comments

@Lvdl-sec
Copy link

Gophish Version : 0.12.1
Gophish Python API Version : 0.5.1
Python Version: 3.11

If i try the basic exemple with my server
`from gophish import Gophish
from gophish.models import *

api_key = 'MyKey'
api_srv = 'https://MyServer/api'

api = Gophish(api_key, host=api_srv)

targets = [
User(first_name='John', last_name='Doe', email='johndoe@example.com'),
User(first_name='Jane', last_name='Doe', email='janedoe@example.com')]

group = Group(name='Doe Company', targets=targets)
group = api.groups.post(group)
print (group.id)`

I get the following error:
Traceback (most recent call last): File "/home/notme/scripts/TestApi.py", line 14, in <module> group = api.groups.post(group) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/gophish/api/groups.py", line 15, in post return super(API, self).post(group) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/gophish/api/api.py", line 106, in post raise Error.parse(response.json()) ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 525, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 375, in decode raise JSONDecodeError("Extra data", s, end, len(s)) simplejson.errors.JSONDecodeError: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)

Is there any wrong with the example or with the API ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant