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
|
Also, tons of packages on pypi that can ANSI colorize strings
|
2019-05-21T14:08:40.330600
|
Chester
|
pythondev_help_Chester_2019-05-21T14:08:40.330600
| 1,558,447,720.3306 | 24,521 |
pythondev
|
help
|
This is exactly what i was looking for.
I just need to play around with it to get it working.
Thanks for your help and the quick reply.
|
2019-05-21T14:13:06.331400
|
Annabell
|
pythondev_help_Annabell_2019-05-21T14:13:06.331400
| 1,558,447,986.3314 | 24,522 |
pythondev
|
help
|
hey guys
|
2019-05-21T15:00:41.332300
|
Genna
|
pythondev_help_Genna_2019-05-21T15:00:41.332300
| 1,558,450,841.3323 | 24,523 |
pythondev
|
help
|
sorry to bother
|
2019-05-21T15:00:43.332500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:00:43.332500
| 1,558,450,843.3325 | 24,524 |
pythondev
|
help
|
def quick_slack(channel, text):
# token=os.environ['SLACK_BOT_TOKEN']
token = "XXXX"
sc = SlackClient(token)
text = BeautifulSoup(text)
print(text)
slacker = slack.WebClient(token)
sc.api_call("chat.postMessage", channel, text)
response = slacker.chat_postMessage(text, channel)
assert response["ok"]
assert response["message"]["text"] == text
|
2019-05-21T15:00:51.332700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:00:51.332700
| 1,558,450,851.3327 | 24,525 |
pythondev
|
help
|
wondering if you've ever seen this
|
2019-05-21T15:00:57.333000
|
Genna
|
pythondev_help_Genna_2019-05-21T15:00:57.333000
| 1,558,450,857.333 | 24,526 |
pythondev
|
help
|
the text I'm slacking is'イーサリアム上に構築された証券取引所、6月に1号企業上場へ: <https://www.coindeskjapan.com/10668/>
KO: 이시 리움에 구축 된 증권 거래소, 6 월에 1 호 기업 상장에CN: 建立在以太坊上的證券交易所將於6月在第一家公司上市EN: A stock exchange built on Ethereum, will be listed on the first company in June'
|
2019-05-21T15:01:23.333300
|
Genna
|
pythondev_help_Genna_2019-05-21T15:01:23.333300
| 1,558,450,883.3333 | 24,527 |
pythondev
|
help
|
and I get an error
|
2019-05-21T15:01:35.333600
|
Genna
|
pythondev_help_Genna_2019-05-21T15:01:35.333600
| 1,558,450,895.3336 | 24,528 |
pythondev
|
help
|
TypeError: api_call() takes from 2 to 3 positional arguments but 4 were given
|
2019-05-21T15:01:45.333800
|
Genna
|
pythondev_help_Genna_2019-05-21T15:01:45.333800
| 1,558,450,905.3338 | 24,529 |
pythondev
|
help
|
which I'm sure is something to do with the text
|
2019-05-21T15:01:56.334100
|
Genna
|
pythondev_help_Genna_2019-05-21T15:01:56.334100
| 1,558,450,916.3341 | 24,530 |
pythondev
|
help
|
Please use the snippet feature, or backticks, when sharing code. You can do so by clicking on the :heavy_plus_sign: on the left of the input box for a snippet.
For more information on snippets click <https://get.slack.help/hc/en-us/articles/204145658-Create-a-snippet|here>.
For more information on inline code formatting with backticks click <https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages#inline-code|here>.
|
2019-05-21T15:02:11.334200
|
Leana
|
pythondev_help_Leana_2019-05-21T15:02:11.334200
| 1,558,450,931.3342 | 24,531 |
pythondev
|
help
|
I'm not familiar enough with other character sets to see what I need to do
|
2019-05-21T15:02:49.334700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:02:49.334700
| 1,558,450,969.3347 | 24,532 |
pythondev
|
help
|
what slack codebase are you using? I’d like to check out the `SlackClient` code
|
2019-05-21T15:04:27.335300
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:04:27.335300
| 1,558,451,067.3353 | 24,533 |
pythondev
|
help
|
hmmm
|
2019-05-21T15:05:21.335800
|
Genna
|
pythondev_help_Genna_2019-05-21T15:05:21.335800
| 1,558,451,121.3358 | 24,534 |
pythondev
|
help
|
def quick_slack(channel, text):
# token=os.environ['SLACK_BOT_TOKEN']
token = "xoxb-638830206405-640874211024-KGbGkW4Pbiu2uW1G2U9wH74R"
sc = SlackClient(token)
#text = BeautifulSoup(text)
#print(text)
#slacker = slack.WebClient(token)
sc.api_call("chat.postMessage", channel, text)
#response = slacker.chat_postMessage(text, channel)
assert response["ok"]
assert response["message"]["text"] == text
|
2019-05-21T15:06:07.336000
|
Genna
|
pythondev_help_Genna_2019-05-21T15:06:07.336000
| 1,558,451,167.336 | 24,535 |
pythondev
|
help
|
sorry my comments didn't save
|
2019-05-21T15:06:13.336300
|
Genna
|
pythondev_help_Genna_2019-05-21T15:06:13.336300
| 1,558,451,173.3363 | 24,536 |
pythondev
|
help
|
neither client works
|
2019-05-21T15:06:21.336700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:06:21.336700
| 1,558,451,181.3367 | 24,537 |
pythondev
|
help
|
unless the text is "Hello World"
|
2019-05-21T15:06:33.337200
|
Genna
|
pythondev_help_Genna_2019-05-21T15:06:33.337200
| 1,558,451,193.3372 | 24,538 |
pythondev
|
help
|
or something simple
|
2019-05-21T15:06:37.337500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:06:37.337500
| 1,558,451,197.3375 | 24,539 |
pythondev
|
help
|
They do, that isn’t what I mean though - where is the SlackClient class defined? are you using a python package from slack?
|
2019-05-21T15:06:46.337700
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:06:46.337700
| 1,558,451,206.3377 | 24,540 |
pythondev
|
help
|
yes
|
2019-05-21T15:07:18.337900
|
Genna
|
pythondev_help_Genna_2019-05-21T15:07:18.337900
| 1,558,451,238.3379 | 24,541 |
pythondev
|
help
|
from slackclient import SlackClient
|
2019-05-21T15:07:25.338100
|
Genna
|
pythondev_help_Genna_2019-05-21T15:07:25.338100
| 1,558,451,245.3381 | 24,542 |
pythondev
|
help
|
are you following some docs? can you point me to them?
|
2019-05-21T15:08:18.338400
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:08:18.338400
| 1,558,451,298.3384 | 24,543 |
pythondev
|
help
|
<https://github.com/slackapi/python-slackclient>
|
2019-05-21T15:08:43.338800
|
Genna
|
pythondev_help_Genna_2019-05-21T15:08:43.338800
| 1,558,451,323.3388 | 24,544 |
pythondev
|
help
|
As far as I can tell the docs are out of sync with the codebase - there doesn’t seem to be a SlackClient in the codebase, unless I am missing something
|
2019-05-21T15:10:37.339700
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:10:37.339700
| 1,558,451,437.3397 | 24,545 |
pythondev
|
help
|
The web client looks like the right one to use
|
2019-05-21T15:12:25.340200
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:12:25.340200
| 1,558,451,545.3402 | 24,546 |
pythondev
|
help
|
neither work with that text
|
2019-05-21T15:12:54.340500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:12:54.340500
| 1,558,451,574.3405 | 24,547 |
pythondev
|
help
|
which is why I added both
|
2019-05-21T15:12:57.340700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:12:57.340700
| 1,558,451,577.3407 | 24,548 |
pythondev
|
help
|
Traceback (most recent call last):
File "feedtest.py", line 41, in <module>
quick_slack("#testing", single_line)
File "feedtest.py", line 21, in quick_slack
response = slacker.chat_postMessage(channel, text)
TypeError: chat_postMessage() takes 1 positional argument but 3 were given
|
2019-05-21T15:14:58.341900
|
Genna
|
pythondev_help_Genna_2019-05-21T15:14:58.341900
| 1,558,451,698.3419 | 24,549 |
pythondev
|
help
|
ah, I see - `chat_postMessage` takes kwargs (keyword arguments) not args. you passed `text, channel` but need `text=<your text>, channel=<your channel>`
|
2019-05-21T15:15:08.342400
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:15:08.342400
| 1,558,451,708.3424 | 24,550 |
pythondev
|
help
|
I swapped channel and text but it throws the same error
|
2019-05-21T15:15:09.342500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:09.342500
| 1,558,451,709.3425 | 24,551 |
pythondev
|
help
|
yeah
|
2019-05-21T15:15:11.342700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:11.342700
| 1,558,451,711.3427 | 24,552 |
pythondev
|
help
|
ohhhhhhh
|
2019-05-21T15:15:21.342900
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:21.342900
| 1,558,451,721.3429 | 24,553 |
pythondev
|
help
|
really?
|
2019-05-21T15:15:24.343100
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:24.343100
| 1,558,451,724.3431 | 24,554 |
pythondev
|
help
|
yes
|
2019-05-21T15:15:26.343300
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:15:26.343300
| 1,558,451,726.3433 | 24,555 |
pythondev
|
help
|
so text=text?
|
2019-05-21T15:15:35.343500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:35.343500
| 1,558,451,735.3435 | 24,556 |
pythondev
|
help
|
or how would I pass that
|
2019-05-21T15:15:39.343700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:15:39.343700
| 1,558,451,739.3437 | 24,557 |
pythondev
|
help
|
given how your code looks it would be `response = slacker.chat_postMessage(text=text, channel=channel)`
|
2019-05-21T15:16:08.344300
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:16:08.344300
| 1,558,451,768.3443 | 24,558 |
pythondev
|
help
|
with the `WebClient`
|
2019-05-21T15:16:17.344600
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:16:17.344600
| 1,558,451,777.3446 | 24,559 |
pythondev
|
help
|
I've never seen that
|
2019-05-21T15:17:00.345500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:17:00.345500
| 1,558,451,820.3455 | 24,560 |
pythondev
|
help
|
python treats positional and keyword arguments differently, and how api’s are coded utilize those differences to make, for instance, optional arguments
|
2019-05-21T15:17:04.345600
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:17:04.345600
| 1,558,451,824.3456 | 24,561 |
pythondev
|
help
|
its fairly normal and often preferred
|
2019-05-21T15:17:26.346100
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:17:26.346100
| 1,558,451,846.3461 | 24,562 |
pythondev
|
help
|
I see
|
2019-05-21T15:17:49.346500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:17:49.346500
| 1,558,451,869.3465 | 24,563 |
pythondev
|
help
|
so it can get the argument in any position
|
2019-05-21T15:18:04.346900
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:04.346900
| 1,558,451,884.3469 | 24,564 |
pythondev
|
help
|
channel=X, text=Y
|
2019-05-21T15:18:12.347500
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:12.347500
| 1,558,451,892.3475 | 24,565 |
pythondev
|
help
|
as long as they come after the positional arguments
|
2019-05-21T15:18:16.347800
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:18:16.347800
| 1,558,451,896.3478 | 24,566 |
pythondev
|
help
|
or text=Y,channel=X
|
2019-05-21T15:18:16.347900
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:16.347900
| 1,558,451,896.3479 | 24,567 |
pythondev
|
help
|
yeah that's great
|
2019-05-21T15:18:22.348100
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:22.348100
| 1,558,451,902.3481 | 24,568 |
pythondev
|
help
|
I appreciate the education
|
2019-05-21T15:18:30.348400
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:30.348400
| 1,558,451,910.3484 | 24,569 |
pythondev
|
help
|
that's honestly the first time I've seen that
|
2019-05-21T15:18:38.348700
|
Genna
|
pythondev_help_Genna_2019-05-21T15:18:38.348700
| 1,558,451,918.3487 | 24,570 |
pythondev
|
help
|
you can look at how `chat_postMessage` is implemented to see why it is used in this case <https://github.com/slackapi/python-slackclient/blob/master/slack/web/client.py#L295>
|
2019-05-21T15:19:02.349200
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:19:02.349200
| 1,558,451,942.3492 | 24,571 |
pythondev
|
help
|
thanks
|
2019-05-21T15:20:16.349600
|
Genna
|
pythondev_help_Genna_2019-05-21T15:20:16.349600
| 1,558,452,016.3496 | 24,572 |
pythondev
|
help
|
if you're ever working on a blockchain let me know. <mailto:[email protected]|[email protected]>
|
2019-05-21T15:20:31.350000
|
Genna
|
pythondev_help_Genna_2019-05-21T15:20:31.350000
| 1,558,452,031.35 | 24,573 |
pythondev
|
help
|
blockchain project
|
2019-05-21T15:20:40.350300
|
Genna
|
pythondev_help_Genna_2019-05-21T15:20:40.350300
| 1,558,452,040.3503 | 24,574 |
pythondev
|
help
|
you probably shouldn't post your slack token here, you may want to go regenerate it
|
2019-05-21T15:23:47.350400
|
Dayna
|
pythondev_help_Dayna_2019-05-21T15:23:47.350400
| 1,558,452,227.3504 | 24,575 |
pythondev
|
help
|
anyone have any experience using smtplib/gmail? i'm writing a script to iterate over a dictionary and send an email for each item. the script works, but fails after sending 120/200 emails. ``` File "/usr/lib/python2.7/smtplib.py", line 369, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed ``` I've tried using SSL and TLS with the same result.
|
2019-05-21T15:39:31.352300
|
Celesta
|
pythondev_help_Celesta_2019-05-21T15:39:31.352300
| 1,558,453,171.3523 | 24,576 |
pythondev
|
help
|
My guess is that you're being purposefully throttled by the mail server.
|
2019-05-21T15:41:47.352700
|
Sasha
|
pythondev_help_Sasha_2019-05-21T15:41:47.352700
| 1,558,453,307.3527 | 24,577 |
pythondev
|
help
|
that's what i'm beginning to think. any ideas on how to get around it?
|
2019-05-21T15:42:15.353100
|
Celesta
|
pythondev_help_Celesta_2019-05-21T15:42:15.353100
| 1,558,453,335.3531 | 24,578 |
pythondev
|
help
|
slow down/batch your email sending
|
2019-05-21T15:44:18.353700
|
Clemmie
|
pythondev_help_Clemmie_2019-05-21T15:44:18.353700
| 1,558,453,458.3537 | 24,579 |
pythondev
|
help
|
It's not immediately obvious if these limits apply to SMTP, but they imply you should be able to get away with up to 2.5 messages per second. <https://developers.google.com/gmail/api/v1/reference/quota>
|
2019-05-21T15:47:31.355000
|
Sasha
|
pythondev_help_Sasha_2019-05-21T15:47:31.355000
| 1,558,453,651.355 | 24,580 |
pythondev
|
help
|
There's also an interesting statement: "The mail sending pipeline is complex: once the user exceeds their quota, there can be a delay of several minutes before the API begins to return 429 error responses. So you cannot assume that a 200 response means the email was successfully sent." So some of your 120 successful emails may actually have failed, too.
|
2019-05-21T15:48:26.356000
|
Sasha
|
pythondev_help_Sasha_2019-05-21T15:48:26.356000
| 1,558,453,706.356 | 24,581 |
pythondev
|
help
|
Also, it's worth noting that Gmail has a limit to the number of emails you can send per day.
|
2019-05-21T15:54:03.358600
|
Carmen
|
pythondev_help_Carmen_2019-05-21T15:54:03.358600
| 1,558,454,043.3586 | 24,582 |
pythondev
|
help
|
they're all being sent to a dummy account i created and can verify they're being delivered. thinking it is something on google's end.
|
2019-05-21T15:54:18.359000
|
Celesta
|
pythondev_help_Celesta_2019-05-21T15:54:18.359000
| 1,558,454,058.359 | 24,583 |
pythondev
|
help
|
Thanks all. Have some ideas to work around it. Hopefully they pan out
|
2019-05-21T15:56:07.360300
|
Celesta
|
pythondev_help_Celesta_2019-05-21T15:56:07.360300
| 1,558,454,167.3603 | 24,584 |
pythondev
|
help
|
Hey guys, i need help with DRF
|
2019-05-21T19:20:15.361600
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:20:15.361600
| 1,558,466,415.3616 | 24,585 |
pythondev
|
help
|
If you have a question, please just ask it. Please do not ask for topic experts; do not DM or ping random users. We cannot begin to answer a question until we actually get a question.
<http://sol.gfxile.net/dontask.html|*Asking Questions*>
|
2019-05-21T19:23:59.361700
|
Leana
|
pythondev_help_Leana_2019-05-21T19:23:59.361700
| 1,558,466,639.3617 | 24,586 |
pythondev
|
help
|
When i try to access self.request in my View, it says, self is not defined
|
2019-05-21T19:25:26.362400
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:25:26.362400
| 1,558,466,726.3624 | 24,587 |
pythondev
|
help
|
This line
```
url = NewResourceSerializer(
context = {'url' : self.request.url}
).data
```
|
2019-05-21T19:27:19.362700
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:27:19.362700
| 1,558,466,839.3627 | 24,588 |
pythondev
|
help
|
You’re gonna need to show more code
|
2019-05-21T19:30:22.363200
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:30:22.363200
| 1,558,467,022.3632 | 24,589 |
pythondev
|
help
|
For example, is this a class based view or function?
|
2019-05-21T19:31:02.364000
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:31:02.364000
| 1,558,467,062.364 | 24,590 |
pythondev
|
help
|
This is my whole class view
```
class ResourceViewSet(GenericViewSet, CreateModelMixin):
queryset = Resource.objects.all()
serializer_class = NewResourceSerializer
url = NewResourceSerializer(
context = {'url' : self.request.url}
).data
```
|
2019-05-21T19:31:07.364200
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:31:07.364200
| 1,558,467,067.3642 | 24,591 |
pythondev
|
help
|
Ok, yeah. That’s not gonna work
|
2019-05-21T19:31:37.364800
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:31:37.364800
| 1,558,467,097.3648 | 24,592 |
pythondev
|
help
|
Because url won’t be used anywhere because none of the default methods know about that attribute
|
2019-05-21T19:32:30.366100
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:32:30.366100
| 1,558,467,150.3661 | 24,593 |
pythondev
|
help
|
Why don’t you step back a bit and describe what you’re trying to do?
|
2019-05-21T19:33:01.367100
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:33:01.367100
| 1,558,467,181.3671 | 24,594 |
pythondev
|
help
|
Uhh
|
2019-05-21T19:33:22.367600
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:33:22.367600
| 1,558,467,202.3676 | 24,595 |
pythondev
|
help
|
Is there a way i can have a VC with you?
|
2019-05-21T19:33:43.368000
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:33:43.368000
| 1,558,467,223.368 | 24,596 |
pythondev
|
help
|
No, sorry
|
2019-05-21T19:34:48.368900
|
Hiroko
|
pythondev_help_Hiroko_2019-05-21T19:34:48.368900
| 1,558,467,288.3689 | 24,597 |
pythondev
|
help
|
If not.
Basically I have a Resource model and a Share Model.
And i want to create an endpoint only to create a Share, which itself creates a resource if a resource doesn’t exist with the same url
|
2019-05-21T19:35:24.370100
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:35:24.370100
| 1,558,467,324.3701 | 24,598 |
pythondev
|
help
|
I know it’s messy but i’m trying to figure out how this thing works
```
class NewResourceSerializer(serializers.ModelSerializer):
# url = serializers.SerializerMethodField()
tags = serializers.PrimaryKeyRelatedField(many=True, queryset=Tag.objects.all(), required=True)
title = serializers.CharField(max_length=50, required=True)
description = serializers.CharField(required=True)
def validate(self, data):
print(data)
url = data['url']
response = requests.get(url)
user = User.objects.first()
soup = BeautifulSoup(response.content, 'html.parser')
og_title = soup.find('meta', property='og:title')['content']
og_description = soup.find('meta', property='og:description')['content']
og_img = soup.find('meta', property='og:image')['content']
resource = Resource.objects.create(url = url, title = og_title, description = og_description, image_url = og_img)
resource.tags.set(data['tags'])
new_data = OrderedDict([('resource', resource), ('title', data['title']), ('description', data['description']), ('user', user)])
return new_data
class Meta:
model = Share
fields = ('title', 'description', 'tags')
```
|
2019-05-21T19:36:03.370700
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:36:03.370700
| 1,558,467,363.3707 | 24,599 |
pythondev
|
help
|
I’m telling it to create through the Share model, because if i try to do it by the Resource model, it’ll need a resource as a FK which still not exists.
|
2019-05-21T19:38:26.371900
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:38:26.371900
| 1,558,467,506.3719 | 24,600 |
pythondev
|
help
|
What i was trying to do with that code is, send a url tag (which Share doesn’t have/need it in it’s model) through context
|
2019-05-21T19:41:25.372700
|
Nanci
|
pythondev_help_Nanci_2019-05-21T19:41:25.372700
| 1,558,467,685.3727 | 24,601 |
pythondev
|
help
|
Hello, I am looking for some direction I am trying to figure out how to apply a bias to a random. Selecting random number between 1 and 1000 a large number of times will average to 500 with even distribution. What I want to be able to do is apply a bias such that all numbers are still selected but with a bias to select a low or a high number more often (resulting in lower or higher average), or a middle bias, such that the average is still 500 but numbers closer to 500 are selected with a higher frequency then numbers Further away
|
2019-05-21T21:11:47.379200
|
Vern
|
pythondev_help_Vern_2019-05-21T21:11:47.379200
| 1,558,473,107.3792 | 24,602 |
pythondev
|
help
|
There's lots of ways to potentially do that, depending on the degree of bias you want. For the low/high case, you could generate a random number between 1 and 1500, and take the range between 1001-1500 to be a duplicate of the 1-500 or 501-1000 range, giving you an extra chance of landing there. For a middle bias, you could generate two numbers 1-500 and sum them, which would tend to cluster towards the center like a pair of dice are more likely to roll 7.
|
2019-05-21T21:27:43.381900
|
Sasha
|
pythondev_help_Sasha_2019-05-21T21:27:43.381900
| 1,558,474,063.3819 | 24,603 |
pythondev
|
help
|
In the most general case, you could figure out exactly the probability distribution you want, and then convert a uniform random number into that distribution with a mapping function.
|
2019-05-21T21:30:06.382700
|
Sasha
|
pythondev_help_Sasha_2019-05-21T21:30:06.382700
| 1,558,474,206.3827 | 24,604 |
pythondev
|
help
|
Hmm thanks, that gives me some ideas I hadn’t considered.
|
2019-05-21T21:33:15.383500
|
Vern
|
pythondev_help_Vern_2019-05-21T21:33:15.383500
| 1,558,474,395.3835 | 24,605 |
pythondev
|
help
|
I really like the adding two randoms together for middle bias, hadn’t considered that, but it makes sense and simple
|
2019-05-21T21:34:31.385100
|
Vern
|
pythondev_help_Vern_2019-05-21T21:34:31.385100
| 1,558,474,471.3851 | 24,606 |
pythondev
|
help
|
Hey yall I have a tkinter window are I would like to embed `glow.gif` into the tkinter window but I cannot find anything on how to easyly embed it
|
2019-05-21T21:59:49.386100
|
Rodrick
|
pythondev_help_Rodrick_2019-05-21T21:59:49.386100
| 1,558,475,989.3861 | 24,607 |
pythondev
|
help
|
how would I do that
|
2019-05-21T21:59:57.386400
|
Rodrick
|
pythondev_help_Rodrick_2019-05-21T21:59:57.386400
| 1,558,475,997.3864 | 24,608 |
pythondev
|
help
|
<@Rodrick> wouldnt you just place it like an image?
<https://stackoverflow.com/questions/10133856/how-to-add-an-image-in-tkinter>
|
2019-05-21T23:19:15.387200
|
Mildred
|
pythondev_help_Mildred_2019-05-21T23:19:15.387200
| 1,558,480,755.3872 | 24,609 |
pythondev
|
help
|
I'm sending HTTPS requests to a Google Function. I'm getting `KeyError: 'message'` which causes the G Function to crash. Which makes no sense, as the message key is clearly part of the JSON body. I have tested the it with requestbin:
|
2019-05-22T00:41:45.389200
|
Conchita
|
pythondev_help_Conchita_2019-05-22T00:41:45.389200
| 1,558,485,705.3892 | 24,610 |
pythondev
|
help
|
Anyone see why this is happening?
|
2019-05-22T00:42:18.389700
|
Conchita
|
pythondev_help_Conchita_2019-05-22T00:42:18.389700
| 1,558,485,738.3897 | 24,611 |
pythondev
|
help
|
what's that last curly bracket in the payload?
|
2019-05-22T00:43:39.390200
|
Erik
|
pythondev_help_Erik_2019-05-22T00:43:39.390200
| 1,558,485,819.3902 | 24,612 |
pythondev
|
help
|
after `length`
|
2019-05-22T00:44:14.390400
|
Erik
|
pythondev_help_Erik_2019-05-22T00:44:14.390400
| 1,558,485,854.3904 | 24,613 |
pythondev
|
help
|
Oh that is only me being a bit quick with pasting some dummy string
|
2019-05-22T00:46:23.391000
|
Conchita
|
pythondev_help_Conchita_2019-05-22T00:46:23.391000
| 1,558,485,983.391 | 24,614 |
pythondev
|
help
|
Made a new call without it
|
2019-05-22T00:46:29.391300
|
Conchita
|
pythondev_help_Conchita_2019-05-22T00:46:29.391300
| 1,558,485,989.3913 | 24,615 |
pythondev
|
help
|
None
|
2019-05-22T00:46:40.391400
|
Conchita
|
pythondev_help_Conchita_2019-05-22T00:46:40.391400
| 1,558,486,000.3914 | 24,616 |
pythondev
|
help
|
Do you have a JSON content-type header? I'm wondering if the API might also accept classic POST forms depending on the header.
|
2019-05-22T00:52:27.392400
|
Sasha
|
pythondev_help_Sasha_2019-05-22T00:52:27.392400
| 1,558,486,347.3924 | 24,617 |
pythondev
|
help
|
The issue might also be on the Function side. Is it your code, or an established API?
|
2019-05-22T00:54:37.392900
|
Sasha
|
pythondev_help_Sasha_2019-05-22T00:54:37.392900
| 1,558,486,477.3929 | 24,618 |
pythondev
|
help
|
Yes I do
|
2019-05-22T01:01:49.393200
|
Conchita
|
pythondev_help_Conchita_2019-05-22T01:01:49.393200
| 1,558,486,909.3932 | 24,619 |
pythondev
|
help
|
The function is my code. This is the part of the code that breaks:
```def other(request):
request_json = request.get_json(silent=True)
title = request_json['message']
message = request_json['payload']```
|
2019-05-22T01:02:28.393800
|
Conchita
|
pythondev_help_Conchita_2019-05-22T01:02:28.393800
| 1,558,486,948.3938 | 24,620 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.