py-ga-mob icon indicating copy to clipboard operation
py-ga-mob copied to clipboard

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

Open yurabysaha opened this issue 2 years ago • 0 comments

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 avatar Apr 17 '22 12:04 yurabysaha