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

Error when adding a header #5

Open
alihussainzada opened this issue Feb 19, 2025 · 0 comments
Open

Error when adding a header #5

alihussainzada opened this issue Feb 19, 2025 · 0 comments

Comments

@alihussainzada
Copy link

alihussainzada commented Feb 19, 2025

I was getting the bellow error:

[ali@koalasec batchql]$ python3 batch.py -e https://api.target.com/graphql/ --header "Api-Key: 999999999"
Traceback (most recent call last):
  File "/home/ali/tools/batchql/batch.py", line 28, in <module>
    point_index = header.find(":")
                  ^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'find'

However i was able to solve the issue by modify the code to:

if args.header:
    for header in args.header:
        if isinstance(header, list):  
            header = header[0] 

        if ":" in header:  # Ensure the format is correct
            point_index = header.find(":")
            header_dict[header[:point_index].strip()] = header[point_index+1:].strip()
        else:
            print(f"Invalid header format: {header}")

instead of:

if args.header:
  for header in args.header:
    point_index = header.find(":")
    header_dict[header[:point_index].strip()] = header[point_index+1:].strip()
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