workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
I feel like the exception happened after/before `login = {'Authorization':'Basic '+ base64.b64encode(username + ":" + password)}`
2018-03-14T16:41:45.000469
Genevie
pythondev_help_Genevie_2018-03-14T16:41:45.000469
1,521,045,705.000469
38,924
pythondev
help
as soon as I try to create it
2018-03-14T16:42:29.000735
Maya
pythondev_help_Maya_2018-03-14T16:42:29.000735
1,521,045,749.000735
38,925
pythondev
help
can you trying a pdb statement before that line and run it to see if the exception happens there?
2018-03-14T16:42:46.000320
Genevie
pythondev_help_Genevie_2018-03-14T16:42:46.000320
1,521,045,766.00032
38,926
pythondev
help
``` >>> import pdb >>> pdb.set_trace() --Return-- > <stdin>(1)<module>()->None (Pdb) login = {'Authorization':'Basic '+ base64.b64encode(username + ":" + password)} *** TypeError: a bytes-like object is required, not 'str' ```
2018-03-14T16:45:13.000124
Maya
pythondev_help_Maya_2018-03-14T16:45:13.000124
1,521,045,913.000124
38,927
pythondev
help
interesting...
2018-03-14T16:45:52.000260
Genevie
pythondev_help_Genevie_2018-03-14T16:45:52.000260
1,521,045,952.00026
38,928
pythondev
help
binascii.b2a_base64 takes a bytes like object, what is s?
2018-03-14T16:46:18.000598
Kristin
pythondev_help_Kristin_2018-03-14T16:46:18.000598
1,521,045,978.000598
38,929
pythondev
help
its supposed to work according to the docs here: <https://docs.python.org/2/library/base64.html#base64.b64encode>
2018-03-14T16:46:56.000095
Genevie
pythondev_help_Genevie_2018-03-14T16:46:56.000095
1,521,046,016.000095
38,930
pythondev
help
oh! its different in python 3.
2018-03-14T16:47:22.000439
Genevie
pythondev_help_Genevie_2018-03-14T16:47:22.000439
1,521,046,042.000439
38,931
pythondev
help
<https://docs.python.org/3/library/base64.html#base64.b64encode>
2018-03-14T16:47:27.000544
Genevie
pythondev_help_Genevie_2018-03-14T16:47:27.000544
1,521,046,047.000544
38,932
pythondev
help
yes, but it doesn’t like a string
2018-03-14T16:47:31.000394
Maya
pythondev_help_Maya_2018-03-14T16:47:31.000394
1,521,046,051.000394
38,933
pythondev
help
in python3
2018-03-14T16:47:36.000552
Maya
pythondev_help_Maya_2018-03-14T16:47:36.000552
1,521,046,056.000552
38,934
pythondev
help
This is what a bytes-like object is defined as <https://docs.python.org/3/glossary.html#term-bytes-like-object>
2018-03-14T16:47:57.000289
Genevie
pythondev_help_Genevie_2018-03-14T16:47:57.000289
1,521,046,077.000289
38,935
pythondev
help
sure, that’s why I did ``` credentials = (username+":"+password).encode('ascii') cred_encoded = base64.b64encode(credentials) ```
2018-03-14T16:48:40.000583
Maya
pythondev_help_Maya_2018-03-14T16:48:40.000583
1,521,046,120.000583
38,936
pythondev
help
but I got the extra `b`.
2018-03-14T16:48:53.000058
Maya
pythondev_help_Maya_2018-03-14T16:48:53.000058
1,521,046,133.000058
38,937
pythondev
help
and the remote endpoint doesn’t like that one
2018-03-14T16:49:05.000324
Maya
pythondev_help_Maya_2018-03-14T16:49:05.000324
1,521,046,145.000324
38,938
pythondev
help
the b shows that it's a byte like object
2018-03-14T16:49:21.000673
Kristin
pythondev_help_Kristin_2018-03-14T16:49:21.000673
1,521,046,161.000673
38,939
pythondev
help
extra b? as in `b""`?
2018-03-14T16:49:25.000258
Genevie
pythondev_help_Genevie_2018-03-14T16:49:25.000258
1,521,046,165.000258
38,940
pythondev
help
right
2018-03-14T16:49:28.000261
Maya
pythondev_help_Maya_2018-03-14T16:49:28.000261
1,521,046,168.000261
38,941
pythondev
help
yes, that is the extra b. I know, sounds weird
2018-03-14T16:49:49.000348
Maya
pythondev_help_Maya_2018-03-14T16:49:49.000348
1,521,046,189.000348
38,942
pythondev
help
I know that it shows that it’s a byte like obj
2018-03-14T16:50:01.000026
Maya
pythondev_help_Maya_2018-03-14T16:50:01.000026
1,521,046,201.000026
38,943
pythondev
help
thats cause b64encode returns bytes
2018-03-14T16:50:01.000313
Genevie
pythondev_help_Genevie_2018-03-14T16:50:01.000313
1,521,046,201.000313
38,944
pythondev
help
I think I’ve lost the way
2018-03-14T16:51:16.000240
Maya
pythondev_help_Maya_2018-03-14T16:51:16.000240
1,521,046,276.00024
38,945
pythondev
help
<https://goo.gl/images/uWGSVu>
2018-03-14T16:51:45.000218
Genevie
pythondev_help_Genevie_2018-03-14T16:51:45.000218
1,521,046,305.000218
38,946
pythondev
help
I’ll do in 2.7 and let’s see
2018-03-14T16:51:54.000020
Maya
pythondev_help_Maya_2018-03-14T16:51:54.000020
1,521,046,314.00002
38,947
pythondev
help
:slightly_smiling_face:
2018-03-14T16:52:06.000410
Maya
pythondev_help_Maya_2018-03-14T16:52:06.000410
1,521,046,326.00041
38,948
pythondev
help
you might be going about it the wrong way
2018-03-14T16:52:07.000628
Genevie
pythondev_help_Genevie_2018-03-14T16:52:07.000628
1,521,046,327.000628
38,949
pythondev
help
sure.
2018-03-14T16:52:20.000676
Maya
pythondev_help_Maya_2018-03-14T16:52:20.000676
1,521,046,340.000676
38,950
pythondev
help
I am gonna do it from again
2018-03-14T16:52:30.000083
Maya
pythondev_help_Maya_2018-03-14T16:52:30.000083
1,521,046,350.000083
38,951
pythondev
help
what does `YWRtaW5fdHJpYWxfdGVzdEB0cmlhbC10ZXN0OlJmNGVTZmFkc2Zhb2l1ISEjIz8/PyUk` represent again?
2018-03-14T16:52:32.000253
Genevie
pythondev_help_Genevie_2018-03-14T16:52:32.000253
1,521,046,352.000253
38,952
pythondev
help
an API key im guessing?
2018-03-14T16:52:49.000081
Genevie
pythondev_help_Genevie_2018-03-14T16:52:49.000081
1,521,046,369.000081
38,953
pythondev
help
yes
2018-03-14T16:52:53.000739
Maya
pythondev_help_Maya_2018-03-14T16:52:53.000739
1,521,046,373.000739
38,954
pythondev
help
that is python3 you're using im assuming
2018-03-14T16:54:03.000624
Kristin
pythondev_help_Kristin_2018-03-14T16:54:03.000624
1,521,046,443.000624
38,955
pythondev
help
try changing `encoded = binascii.b2a_base64(s, newline=False)` to `encoded = binascii.b2a_base64(s.encode('utf-8'), newline=False)`
2018-03-14T16:55:06.000395
Kristin
pythondev_help_Kristin_2018-03-14T16:55:06.000395
1,521,046,506.000395
38,956
pythondev
help
sorry im sorta between things atm hence the sporadic replies :neutral_face:
2018-03-14T16:55:47.000802
Kristin
pythondev_help_Kristin_2018-03-14T16:55:47.000802
1,521,046,547.000802
38,957
pythondev
help
no worries, thanks for helping me
2018-03-14T16:56:09.000488
Maya
pythondev_help_Maya_2018-03-14T16:56:09.000488
1,521,046,569.000488
38,958
pythondev
help
<@Kristin> I think that's gonna keep the `b`
2018-03-14T16:56:45.000063
Genevie
pythondev_help_Genevie_2018-03-14T16:56:45.000063
1,521,046,605.000063
38,959
pythondev
help
but you should try sending that
2018-03-14T16:56:52.000761
Genevie
pythondev_help_Genevie_2018-03-14T16:56:52.000761
1,521,046,612.000761
38,960
pythondev
help
yes it is
2018-03-14T16:56:54.000039
Maya
pythondev_help_Maya_2018-03-14T16:56:54.000039
1,521,046,614.000039
38,961
pythondev
help
no it breaks
2018-03-14T16:57:03.000140
Maya
pythondev_help_Maya_2018-03-14T16:57:03.000140
1,521,046,623.00014
38,962
pythondev
help
hmm, does the b stay when it reaches the client?
2018-03-14T16:57:16.000633
Genevie
pythondev_help_Genevie_2018-03-14T16:57:16.000633
1,521,046,636.000633
38,963
pythondev
help
it seems so
2018-03-14T16:57:24.000167
Maya
pythondev_help_Maya_2018-03-14T16:57:24.000167
1,521,046,644.000167
38,964
pythondev
help
it’s in the headers of the request
2018-03-14T16:57:32.000411
Maya
pythondev_help_Maya_2018-03-14T16:57:32.000411
1,521,046,652.000411
38,965
pythondev
help
oh
2018-03-14T16:57:37.000213
Genevie
pythondev_help_Genevie_2018-03-14T16:57:37.000213
1,521,046,657.000213
38,966
pythondev
help
you need to decode it first
2018-03-14T16:58:04.000498
Genevie
pythondev_help_Genevie_2018-03-14T16:58:04.000498
1,521,046,684.000498
38,967
pythondev
help
duhhhh lol
2018-03-14T16:58:06.000382
Genevie
pythondev_help_Genevie_2018-03-14T16:58:06.000382
1,521,046,686.000382
38,968
pythondev
help
whatever you return after that wants decoding ^^
2018-03-14T16:58:10.000658
Kristin
pythondev_help_Kristin_2018-03-14T16:58:10.000658
1,521,046,690.000658
38,969
pythondev
help
try a str(cred_encoded, encoding)
2018-03-14T16:58:20.000137
Terica
pythondev_help_Terica_2018-03-14T16:58:20.000137
1,521,046,700.000137
38,970
pythondev
help
or just do `cred_encoded.decode()`
2018-03-14T16:58:46.000480
Genevie
pythondev_help_Genevie_2018-03-14T16:58:46.000480
1,521,046,726.00048
38,971
pythondev
help
yup :slightly_smiling_face:
2018-03-14T16:58:53.000303
Kristin
pythondev_help_Kristin_2018-03-14T16:58:53.000303
1,521,046,733.000303
38,972
pythondev
help
maybe explicitly pass the encoding (e.g. UTF-8)
2018-03-14T16:59:09.000103
Genevie
pythondev_help_Genevie_2018-03-14T16:59:09.000103
1,521,046,749.000103
38,973
pythondev
help
this will decode the bytes str to unicode str
2018-03-14T16:59:13.000361
Terica
pythondev_help_Terica_2018-03-14T16:59:13.000361
1,521,046,753.000361
38,974
pythondev
help
ok. So first I encode, then I decode it
2018-03-14T16:59:36.000701
Maya
pythondev_help_Maya_2018-03-14T16:59:36.000701
1,521,046,776.000701
38,975
pythondev
help
…
2018-03-14T16:59:39.000026
Maya
pythondev_help_Maya_2018-03-14T16:59:39.000026
1,521,046,779.000026
38,976
pythondev
help
well you encode it so b64encode gets what it wants
2018-03-14T17:00:12.000163
Genevie
pythondev_help_Genevie_2018-03-14T17:00:12.000163
1,521,046,812.000163
38,977
pythondev
help
and then decode the result of b64encode to get what you want :slightly_smiling_face:
2018-03-14T17:00:26.000155
Genevie
pythondev_help_Genevie_2018-03-14T17:00:26.000155
1,521,046,826.000155
38,978
pythondev
help
I like the auto +1 you use :slightly_smiling_face:
2018-03-14T17:00:56.000506
Maya
pythondev_help_Maya_2018-03-14T17:00:56.000506
1,521,046,856.000506
38,979
pythondev
help
ok guys I am gonna have a test
2018-03-14T17:01:10.000008
Maya
pythondev_help_Maya_2018-03-14T17:01:10.000008
1,521,046,870.000008
38,980
pythondev
help
let us know what happens
2018-03-14T17:01:25.000270
Genevie
pythondev_help_Genevie_2018-03-14T17:01:25.000270
1,521,046,885.00027
38,981
pythondev
help
where did the binascii stuff come from?
2018-03-14T17:03:33.000144
Kristin
pythondev_help_Kristin_2018-03-14T17:03:33.000144
1,521,047,013.000144
38,982
pythondev
help
I don’t get it either
2018-03-14T17:03:47.000091
Terica
pythondev_help_Terica_2018-03-14T17:03:47.000091
1,521,047,027.000091
38,983
pythondev
help
I would use base64.b64encode
2018-03-14T17:03:50.000378
Terica
pythondev_help_Terica_2018-03-14T17:03:50.000378
1,521,047,030.000378
38,984
pythondev
help
this will return a string
2018-03-14T17:04:00.000390
Terica
pythondev_help_Terica_2018-03-14T17:04:00.000390
1,521,047,040.00039
38,985
pythondev
help
unicode type
2018-03-14T17:04:04.000619
Terica
pythondev_help_Terica_2018-03-14T17:04:04.000619
1,521,047,044.000619
38,986
pythondev
help
yeah the docs say you wouldn't normally use it
2018-03-14T17:04:08.000408
Kristin
pythondev_help_Kristin_2018-03-14T17:04:08.000408
1,521,047,048.000408
38,987
pythondev
help
base64.b64encode returns a byte object apparently
2018-03-14T17:05:31.000584
Genevie
pythondev_help_Genevie_2018-03-14T17:05:31.000584
1,521,047,131.000584
38,988
pythondev
help
<https://docs.python.org/3/howto/unicode.html> might be worth a read for you <@Maya>
2018-03-14T17:05:35.000080
Kristin
pythondev_help_Kristin_2018-03-14T17:05:35.000080
1,521,047,135.00008
38,989
pythondev
help
sure
2018-03-14T17:06:05.000489
Maya
pythondev_help_Maya_2018-03-14T17:06:05.000489
1,521,047,165.000489
38,990
pythondev
help
<@Genevie> hum
2018-03-14T17:07:32.000241
Terica
pythondev_help_Terica_2018-03-14T17:07:32.000241
1,521,047,252.000241
38,991
pythondev
help
oh yep
2018-03-14T17:07:48.000345
Terica
pythondev_help_Terica_2018-03-14T17:07:48.000345
1,521,047,268.000345
38,992
pythondev
help
it works
2018-03-14T17:15:35.000090
Maya
pythondev_help_Maya_2018-03-14T17:15:35.000090
1,521,047,735.00009
38,993
pythondev
help
``` convert_to_b64 = base64.b64encode(encoded_credentials) print("Basic " + convert_to_b64.decode()) ```
2018-03-14T17:16:08.000571
Maya
pythondev_help_Maya_2018-03-14T17:16:08.000571
1,521,047,768.000571
38,994
pythondev
help
thanks guys.
2018-03-14T17:16:14.000494
Maya
pythondev_help_Maya_2018-03-14T17:16:14.000494
1,521,047,774.000494
38,995
pythondev
help
&gt;&gt;&gt; username = ‘james’ &gt;&gt;&gt; password = ‘dean’ &gt;&gt;&gt; credentials = (username+“:”+password) &gt;&gt;&gt; cred_encoded = base64.b64encode(credentials) &gt;&gt;&gt; print (“basic ” + cred_encoded) basic amFtZXM6ZGVhbg==
2018-03-14T17:16:33.000115
Terica
pythondev_help_Terica_2018-03-14T17:16:33.000115
1,521,047,793.000115
38,996
pythondev
help
ahahaha
2018-03-14T17:16:34.000540
Terica
pythondev_help_Terica_2018-03-14T17:16:34.000540
1,521,047,794.00054
38,997
pythondev
help
I was just testing the theory
2018-03-14T17:16:45.000148
Terica
pythondev_help_Terica_2018-03-14T17:16:45.000148
1,521,047,805.000148
38,998
pythondev
help
:slightly_smiling_face:
2018-03-14T17:16:45.000302
Maya
pythondev_help_Maya_2018-03-14T17:16:45.000302
1,521,047,805.000302
38,999
pythondev
help
I was pretty sure it will return an unicode string
2018-03-14T17:17:17.000221
Terica
pythondev_help_Terica_2018-03-14T17:17:17.000221
1,521,047,837.000221
39,000
pythondev
help
nice credentials btw
2018-03-14T17:17:43.000226
Maya
pythondev_help_Maya_2018-03-14T17:17:43.000226
1,521,047,863.000226
39,001
pythondev
help
the decode() is not necessary
2018-03-14T17:18:46.000325
Terica
pythondev_help_Terica_2018-03-14T17:18:46.000325
1,521,047,926.000325
39,002
pythondev
help
it is implicit
2018-03-14T17:18:49.000174
Terica
pythondev_help_Terica_2018-03-14T17:18:49.000174
1,521,047,929.000174
39,003
pythondev
help
no
2018-03-14T17:20:06.000480
Maya
pythondev_help_Maya_2018-03-14T17:20:06.000480
1,521,048,006.00048
39,004
pythondev
help
that’s for the taco :wink:
2018-03-14T17:20:08.000130
Terica
pythondev_help_Terica_2018-03-14T17:20:08.000130
1,521,048,008.00013
39,005
pythondev
help
you got an error if you don’t encode(‘ascii’)
2018-03-14T17:20:20.000218
Maya
pythondev_help_Maya_2018-03-14T17:20:20.000218
1,521,048,020.000218
39,006
pythondev
help
``` username ='james' password='dean' credentials = (username+":"+password) cred_encoded = base64.standard_b64encode(credentials) Traceback (most recent call last): File "&lt;input&gt;", line 1, in &lt;module&gt; File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/base64.py", line 95, in standard_...
2018-03-14T17:20:32.000107
Maya
pythondev_help_Maya_2018-03-14T17:20:32.000107
1,521,048,032.000107
39,007
pythondev
help
aaaah yes, true
2018-03-14T17:20:33.000121
Terica
pythondev_help_Terica_2018-03-14T17:20:33.000121
1,521,048,033.000121
39,008
pythondev
help
because you forced it
2018-03-14T17:20:39.000056
Terica
pythondev_help_Terica_2018-03-14T17:20:39.000056
1,521,048,039.000056
39,009
pythondev
help
I did not
2018-03-14T17:20:41.000212
Terica
pythondev_help_Terica_2018-03-14T17:20:41.000212
1,521,048,041.000212
39,010
pythondev
help
what do u mean
2018-03-14T17:20:53.000060
Maya
pythondev_help_Maya_2018-03-14T17:20:53.000060
1,521,048,053.00006
39,011
pythondev
help
my code is only this
2018-03-14T17:21:11.000306
Terica
pythondev_help_Terica_2018-03-14T17:21:11.000306
1,521,048,071.000306
39,012
pythondev
help
&gt;&gt;&gt; username = 'james' &gt;&gt;&gt; password = 'dean' &gt;&gt;&gt; credentials = (username+":"+password) &gt;&gt;&gt; cred_encoded = base64.b64encode(credentials) &gt;&gt;&gt; print ("basic " + cred_encoded) basic amFtZXM6ZGVhbg== &gt;&gt;&gt; print ("basic " + cred_encoded.decode()) basic amFtZXM6ZGVhbg==
2018-03-14T17:21:11.000566
Terica
pythondev_help_Terica_2018-03-14T17:21:11.000566
1,521,048,071.000566
39,013
pythondev
help
are you using 3.x?
2018-03-14T17:21:55.000042
Maya
pythondev_help_Maya_2018-03-14T17:21:55.000042
1,521,048,115.000042
39,014
pythondev
help
nope
2018-03-14T17:21:58.000087
Terica
pythondev_help_Terica_2018-03-14T17:21:58.000087
1,521,048,118.000087
39,015
pythondev
help
ahhh
2018-03-14T17:22:00.000288
Maya
pythondev_help_Maya_2018-03-14T17:22:00.000288
1,521,048,120.000288
39,016
pythondev
help
2710
2018-03-14T17:22:02.000346
Terica
pythondev_help_Terica_2018-03-14T17:22:02.000346
1,521,048,122.000346
39,017
pythondev
help
I am not yet ready to move to 3
2018-03-14T17:22:16.000373
Terica
pythondev_help_Terica_2018-03-14T17:22:16.000373
1,521,048,136.000373
39,018
pythondev
help
<https://docs.python.org/3/library/base64.html#base64.b64encode>
2018-03-14T17:22:28.000145
Maya
pythondev_help_Maya_2018-03-14T17:22:28.000145
1,521,048,148.000145
39,019
pythondev
help
``` base64.b64encode(s, altchars=None) Encode the bytes-like object s using Base64 and return the encoded bytes. ```
2018-03-14T17:22:39.000547
Maya
pythondev_help_Maya_2018-03-14T17:22:39.000547
1,521,048,159.000547
39,020
pythondev
help
I feel like I am well in the relationship, we spend lots of time together, but I am not yet ready to move in :wink:
2018-03-14T17:22:46.000568
Terica
pythondev_help_Terica_2018-03-14T17:22:46.000568
1,521,048,166.000568
39,021
pythondev
help
ahahha
2018-03-14T17:22:57.000559
Maya
pythondev_help_Maya_2018-03-14T17:22:57.000559
1,521,048,177.000559
39,022
pythondev
help
I missed the 3.x part
2018-03-14T17:23:32.000348
Terica
pythondev_help_Terica_2018-03-14T17:23:32.000348
1,521,048,212.000348
39,023