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

Python3.7: TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. when I have query_string > 2036 #42

Open
yurabysaha opened this issue Apr 17, 2022 · 0 comments

Comments

@yurabysaha
Copy link

Describe the bug
I can see this error if I have: query_string > 2036. As I can see the problem in pyga.requsts.py in build_http_request link to method

So, as you can see when query_string > 2036 we try to use post and set query_string as a data post = query_string. Than it raise this error.

Error stack-trace:

File "pyga/requests.py", line 880, in track_event
          request.fire()
  File "pyga/requests.py", line 110, in fire
              self.__send()
  File "pyga/requests.py", line 96, in __send
                  request, timeout=self.config.request_timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
      return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 523, in open
              req = meth(req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1280, in do_request_
                  raise TypeError(msg)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

To Reproduce
Steps to reproduce the behavior:

  1. Use Python3.7
  2. Build http request where query_string > 2036 and use this library
  3. See error

Expected behavior
It should not give an error.

@yurabysaha yurabysaha changed the title Python3.7: TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. when I query_string > 2036have Python3.7: TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. when I have query_string > 2036 Apr 17, 2022
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