[issue41124] String with encode causing addition of 'b' in the beginning

2020-06-25 Thread Srinivas Sampath


New submission from Srinivas Sampath :

I am trying to run the attached code.  when hard-coding the string in the URL 
and doing .encode, then the code works.  However since i am requesting user 
input, i cannot hard-code and the code seem to add the 'b' character in the 
beginning causing the request to fail with output like this

Enter Hostname:
hostname cannot be empty
Enter Port Number :
before invokingGET http://psglx73:24670/coreservices/DomainService HTTP/1.1


after encode
b'GET http://psglx73:24670/coreservices/DomainService HTTP/1.1\r\n\r\n'
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Date: Fri, 26 Jun 2020 05:06:21 GMT
Connection: close
Server: Informatica

0

i cannot pass without .encode to the socket communication.  is this reported 
problem ?

--
files: ex_12_informatica.py
messages: 372408
nosy: Srinivas Sampath
priority: normal
severity: normal
status: open
title: String with encode causing addition of 'b' in the beginning
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49264/ex_12_informatica.py

___
Python tracker 
<https://bugs.python.org/issue41124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41124] String with encode causing addition of 'b' in the beginning

2020-06-25 Thread Srinivas Sampath


Srinivas Sampath  added the comment:

if you look at my code, couple of lines below the print, i am actually
doing the send over the socket.  It took me awhile to figure out why the
socket is failing.  I understand that the byte array is represented with a
'b' infront as part of encode function being called, and troubleshooting
the code it was the first obvious difference that made me thing it was an
issue.

Thanks for your help

On Thu, Jun 25, 2020 at 10:37 PM SilentGhost  wrote:

>
> SilentGhost  added the comment:
>
> Your request is likely failing for entirely different reasons.
>
> What you've done is encoded a str object into bytes object, which is
> represented with as literal using b prefix. It isn't being sent over the
> socket.
>
> --
> nosy: +SilentGhost
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> <https://bugs.python.org/issue41124>
> ___
>

-- 
With Regards,

Srinivas Sampath

--

___
Python tracker 
<https://bugs.python.org/issue41124>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com