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
My discord bot is a python script that runs and responds to stuff like !thetime etc and replies with JSON data, it's really basic, thats all I'm looking to create really, but I've no idea where to start really.
2019-02-28T06:43:28.047800
Rosetta
pythondev_help_Rosetta_2019-02-28T06:43:28.047800
1,551,336,208.0478
11,321
pythondev
help
There you go
2019-02-28T06:44:04.048000
Valeri
pythondev_help_Valeri_2019-02-28T06:44:04.048000
1,551,336,244.048
11,322
pythondev
help
You wish to build a bot to achieve what?
2019-02-28T06:44:25.048400
Valeri
pythondev_help_Valeri_2019-02-28T06:44:25.048400
1,551,336,265.0484
11,323
pythondev
help
Just respond with data to specific keywords?
2019-02-28T06:44:49.048800
Valeri
pythondev_help_Valeri_2019-02-28T06:44:49.048800
1,551,336,289.0488
11,324
pythondev
help
Yep pretty much
2019-02-28T06:44:57.049000
Rosetta
pythondev_help_Rosetta_2019-02-28T06:44:57.049000
1,551,336,297.049
11,325
pythondev
help
are you looking to build a Discord bot in python?
2019-02-28T06:45:15.049700
Mica
pythondev_help_Mica_2019-02-28T06:45:15.049700
1,551,336,315.0497
11,326
pythondev
help
I'm still learning Python, and I found the videos ok but I feel I'm learning more if I am creating something I enjoy using..?
2019-02-28T06:45:27.050200
Rosetta
pythondev_help_Rosetta_2019-02-28T06:45:27.050200
1,551,336,327.0502
11,327
pythondev
help
pretty sure there's a package atm, but it's going through some radical changes atm
2019-02-28T06:45:32.050300
Mica
pythondev_help_Mica_2019-02-28T06:45:32.050300
1,551,336,332.0503
11,328
pythondev
help
are you sure, that double-clicking the combobox while not selecting anything does not change the apps fous? I can replicate that on two machines
2019-02-28T06:45:38.050600
Shawana
pythondev_help_Shawana_2019-02-28T06:45:38.050600
1,551,336,338.0506
11,329
pythondev
help
<@Mica> - I've done that, it's a slack bot I want to try now
2019-02-28T06:45:53.051300
Rosetta
pythondev_help_Rosetta_2019-02-28T06:45:53.051300
1,551,336,353.0513
11,330
pythondev
help
oh right, pretty sure there's a package for sending and receiving messages on Slack
2019-02-28T06:46:24.051900
Mica
pythondev_help_Mica_2019-02-28T06:46:24.051900
1,551,336,384.0519
11,331
pythondev
help
thee's even a python Slackbot on this group :stuck_out_tongue:
2019-02-28T06:46:37.052200
Mica
pythondev_help_Mica_2019-02-28T06:46:37.052200
1,551,336,397.0522
11,332
pythondev
help
I'm trying to make it really basic as I'm still learning and very much a beginner
2019-02-28T06:47:25.053300
Rosetta
pythondev_help_Rosetta_2019-02-28T06:47:25.053300
1,551,336,445.0533
11,333
pythondev
help
This is pretty much all you'd ever need <https://api.slack.com/slack-apps>
2019-02-28T06:47:33.053500
Valeri
pythondev_help_Valeri_2019-02-28T06:47:33.053500
1,551,336,453.0535
11,334
pythondev
help
<https://www.fullstackpython.com/blog/build-first-slack-bot-python.html>
2019-02-28T06:49:03.053800
Valeri
pythondev_help_Valeri_2019-02-28T06:49:03.053800
1,551,336,543.0538
11,335
pythondev
help
is a really good resource for kicking off a slack app using Python
2019-02-28T06:49:31.054600
Valeri
pythondev_help_Valeri_2019-02-28T06:49:31.054600
1,551,336,571.0546
11,336
pythondev
help
Yeah waqas, I've tried using that one and I keep getting a RTM socked closed error
2019-02-28T06:50:23.055200
Rosetta
pythondev_help_Rosetta_2019-02-28T06:50:23.055200
1,551,336,623.0552
11,337
pythondev
help
Well then that's what you should've directly asked :slightly_smiling_face:
2019-02-28T06:51:08.055700
Valeri
pythondev_help_Valeri_2019-02-28T06:51:08.055700
1,551,336,668.0557
11,338
pythondev
help
What is the problem there?
2019-02-28T06:51:16.056000
Valeri
pythondev_help_Valeri_2019-02-28T06:51:16.056000
1,551,336,676.056
11,339
pythondev
help
Can you provide the stacktrace?
2019-02-28T06:51:25.056300
Valeri
pythondev_help_Valeri_2019-02-28T06:51:25.056300
1,551,336,685.0563
11,340
pythondev
help
```(starterbot) macos14:starterbot tom$ python3 starterbot.py Starter Bot connected and running! Traceback (most recent call last): File "/Users/tom/starterbot/lib/python3.6/site-packages/slackclient/server.py", line 278, in websocket_safe_read data += "{0}\n".format(self.websocket.recv()) File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_core.py", line 313, in recv opcode, data = self.recv_data() File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_core.py", line 330, in recv_data opcode, frame = self.recv_data_frame(control_frame) File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_core.py", line 343, in recv_data_frame frame = self.recv_frame() File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_core.py", line 377, in recv_frame return self.frame_buffer.recv_frame() File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_abnf.py", line 361, in recv_frame self.recv_header() File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_abnf.py", line 309, in recv_header header = self.recv_strict(2) File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_abnf.py", line 396, in recv_strict bytes_ = self.recv(min(16384, shortage)) File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_core.py", line 452, in _recv return recv(self.sock, bufsize) File "/Users/tom/starterbot/lib/python3.6/site-packages/websocket/_socket.py", line 112, in recv "Connection is already closed.") websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "starterbot.py", line 65, in &lt;module&gt; command, channel = parse_bot_commands(slack_client.rtm_read()) File "/Users/tom/starterbot/lib/python3.6/site-packages/slackclient/client.py", line 235, in rtm_read json_data = self.server.websocket_safe_read() File "/Users/tom/starterbot/lib/python3.6/site-packages/slackclient/server.py", line 296, in websocket_safe_read "Unable to send due to closed RTM websocket" slackclient.server.SlackConnectionError: Unable to send due to closed RTM websocket```
2019-02-28T06:54:05.056600
Rosetta
pythondev_help_Rosetta_2019-02-28T06:54:05.056600
1,551,336,845.0566
11,341
pythondev
help
What does `pip freeze | grep slack` give you?
2019-02-28T06:56:47.057300
Valeri
pythondev_help_Valeri_2019-02-28T06:56:47.057300
1,551,337,007.0573
11,342
pythondev
help
Also, `pip freeze | grep websocket`
2019-02-28T06:57:26.057800
Valeri
pythondev_help_Valeri_2019-02-28T06:57:26.057800
1,551,337,046.0578
11,343
pythondev
help
```slackclient==1.3.0```
2019-02-28T06:57:31.058100
Rosetta
pythondev_help_Rosetta_2019-02-28T06:57:31.058100
1,551,337,051.0581
11,344
pythondev
help
```websocket-client==0.55.0 websockets==3.4```
2019-02-28T06:57:47.058300
Rosetta
pythondev_help_Rosetta_2019-02-28T06:57:47.058300
1,551,337,067.0583
11,345
pythondev
help
Aah there it is!
2019-02-28T06:58:06.058500
Valeri
pythondev_help_Valeri_2019-02-28T06:58:06.058500
1,551,337,086.0585
11,346
pythondev
help
`websocket-client==0.55.0` does not work
2019-02-28T06:58:17.058800
Valeri
pythondev_help_Valeri_2019-02-28T06:58:17.058800
1,551,337,097.0588
11,347
pythondev
help
`websocket-client==0.54.0` will
2019-02-28T06:58:25.059100
Valeri
pythondev_help_Valeri_2019-02-28T06:58:25.059100
1,551,337,105.0591
11,348
pythondev
help
Do `pip uninstall websocket-client`
2019-02-28T06:59:05.059500
Valeri
pythondev_help_Valeri_2019-02-28T06:59:05.059500
1,551,337,145.0595
11,349
pythondev
help
And then `pip install websocket-client==0.54.0`
2019-02-28T06:59:33.060000
Valeri
pythondev_help_Valeri_2019-02-28T06:59:33.060000
1,551,337,173.06
11,350
pythondev
help
And then run your code
2019-02-28T06:59:53.060300
Valeri
pythondev_help_Valeri_2019-02-28T06:59:53.060300
1,551,337,193.0603
11,351
pythondev
help
Same issue
2019-02-28T07:00:40.060500
Rosetta
pythondev_help_Rosetta_2019-02-28T07:00:40.060500
1,551,337,240.0605
11,352
pythondev
help
Okay
2019-02-28T07:00:48.060700
Valeri
pythondev_help_Valeri_2019-02-28T07:00:48.060700
1,551,337,248.0607
11,353
pythondev
help
Can you do `pip show websocket-client`?
2019-02-28T07:01:04.061200
Valeri
pythondev_help_Valeri_2019-02-28T07:01:04.061200
1,551,337,264.0612
11,354
pythondev
help
```Name: websocket-client Version: 0.54.0 Summary: WebSocket client for Python. hybi13 is supported. Home-page: <https://github.com/websocket-client/websocket-client.git> Author: liris Author-email: <mailto:[email protected]|[email protected]> License: BSD Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages Requires: six Required-by: slackclient```
2019-02-28T07:01:29.061400
Rosetta
pythondev_help_Rosetta_2019-02-28T07:01:29.061400
1,551,337,289.0614
11,355
pythondev
help
Interesting
2019-02-28T07:02:55.062100
Valeri
pythondev_help_Valeri_2019-02-28T07:02:55.062100
1,551,337,375.0621
11,356
pythondev
help
What's you python version?
2019-02-28T07:04:07.062800
Valeri
pythondev_help_Valeri_2019-02-28T07:04:07.062800
1,551,337,447.0628
11,357
pythondev
help
My discord bot is literally:
2019-02-28T07:04:09.062900
Rosetta
pythondev_help_Rosetta_2019-02-28T07:04:09.062900
1,551,337,449.0629
11,358
pythondev
help
```import discord TOKEN = 'XXXXXXXXXX' client = discord.Client() @client.event async def on_message(message): # we do not want the bot to reply to itself if message.author == client.user: return if message.content.startswith('!hello'): msg = 'Hello {0.author.mention}'.format(message) await client.send_message(message.channel, msg) @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) print('------') client.run(TOKEN)```
2019-02-28T07:04:12.063100
Rosetta
pythondev_help_Rosetta_2019-02-28T07:04:12.063100
1,551,337,452.0631
11,359
pythondev
help
Python 3.6.5
2019-02-28T07:04:39.063300
Rosetta
pythondev_help_Rosetta_2019-02-28T07:04:39.063300
1,551,337,479.0633
11,360
pythondev
help
<@Faustina> since tht data is coming in from the client, can’t you work with that to clean up the input?
2019-02-28T07:06:17.064200
Hiroko
pythondev_help_Hiroko_2019-02-28T07:06:17.064200
1,551,337,577.0642
11,361
pythondev
help
looked at your example data. IMO, if the client is sending malformed data with those weird UTF chars,
2019-02-28T07:07:01.065100
Hiroko
pythondev_help_Hiroko_2019-02-28T07:07:01.065100
1,551,337,621.0651
11,362
pythondev
help
like `"<http://www.example.com/ex�mple>"` for what should be a simple `a` character
2019-02-28T07:07:23.065600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:07:23.065600
1,551,337,643.0656
11,363
pythondev
help
that’s more a client issue than a server side issue
2019-02-28T07:07:34.065900
Hiroko
pythondev_help_Hiroko_2019-02-28T07:07:34.065900
1,551,337,654.0659
11,364
pythondev
help
I'm thinking about running my dict with request_data through this code <https://gist.github.com/chris-hailstorm/4989643>
2019-02-28T07:07:47.066100
Faustina
pythondev_help_Faustina_2019-02-28T07:07:47.066100
1,551,337,667.0661
11,365
pythondev
help
are you using pythonn 2 or 3?
2019-02-28T07:08:06.066500
Hiroko
pythondev_help_Hiroko_2019-02-28T07:08:06.066500
1,551,337,686.0665
11,366
pythondev
help
which I think should fix those issues
2019-02-28T07:08:07.066600
Faustina
pythondev_help_Faustina_2019-02-28T07:08:07.066600
1,551,337,687.0666
11,367
pythondev
help
3.7
2019-02-28T07:08:10.066800
Faustina
pythondev_help_Faustina_2019-02-28T07:08:10.066800
1,551,337,690.0668
11,368
pythondev
help
gotcha
2019-02-28T07:08:13.067100
Hiroko
pythondev_help_Hiroko_2019-02-28T07:08:13.067100
1,551,337,693.0671
11,369
pythondev
help
&gt;&gt;&gt;The JSON spec (<http://www.ietf.org/rfc/rfc4627.txt>) -- “JSON text SHALL be encoded in Unicode”. For apps that don’t use unicode, this function walks through all levels of a JSON data structure and converts each item to ASCII
2019-02-28T07:08:41.067400
Hiroko
pythondev_help_Hiroko_2019-02-28T07:08:41.067400
1,551,337,721.0674
11,370
pythondev
help
IMO, why bother?
2019-02-28T07:08:45.067600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:08:45.067600
1,551,337,725.0676
11,371
pythondev
help
because if a client can’t be bothered to send in well formatted data that matches to the standard, why handle the edge cases?
2019-02-28T07:09:15.068200
Hiroko
pythondev_help_Hiroko_2019-02-28T07:09:15.068200
1,551,337,755.0682
11,372
pythondev
help
unless this is a _really_ high paying client, I’d push back
2019-02-28T07:09:42.068600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:09:42.068600
1,551,337,782.0686
11,373
pythondev
help
<@Rosetta> This should have worked right
2019-02-28T07:12:00.070700
Valeri
pythondev_help_Valeri_2019-02-28T07:12:00.070700
1,551,337,920.0707
11,374
pythondev
help
You're sure you're not messing up your virtualenvs?
2019-02-28T07:12:15.071300
Valeri
pythondev_help_Valeri_2019-02-28T07:12:15.071300
1,551,337,935.0713
11,375
pythondev
help
As far as I know. I tried this step by step on 2 macs, a raspberry pi and also at my work incase it's a network issue
2019-02-28T07:12:49.072300
Rosetta
pythondev_help_Rosetta_2019-02-28T07:12:49.072300
1,551,337,969.0723
11,376
pythondev
help
I'm like 99% sure that those requests comes from automated bots, so you suggest just drop those requests instantly without saving? But again how to detect that that those chars is is not formatted well? And on DFR I set that to accept only 'STRICT_JSON': True, and when api receives those, I assume it's valid json data
2019-02-28T07:13:24.073100
Faustina
pythondev_help_Faustina_2019-02-28T07:13:24.073100
1,551,338,004.0731
11,377
pythondev
help
well, the error will raise an exception
2019-02-28T07:13:51.073700
Hiroko
pythondev_help_Hiroko_2019-02-28T07:13:51.073700
1,551,338,031.0737
11,378
pythondev
help
My idea was to json.dumps that dict, and then json.loads, but if api accepts those values, that means it's valid and there wil be no errors
2019-02-28T07:14:09.074300
Faustina
pythondev_help_Faustina_2019-02-28T07:14:09.074300
1,551,338,049.0743
11,379
pythondev
help
and you can handle that and return a 400
2019-02-28T07:14:15.074500
Hiroko
pythondev_help_Hiroko_2019-02-28T07:14:15.074500
1,551,338,055.0745
11,380
pythondev
help
exactly
2019-02-28T07:14:26.074700
Hiroko
pythondev_help_Hiroko_2019-02-28T07:14:26.074700
1,551,338,066.0747
11,381
pythondev
help
handle the well formed requests, return errors when things go wrong
2019-02-28T07:14:48.075200
Hiroko
pythondev_help_Hiroko_2019-02-28T07:14:48.075200
1,551,338,088.0752
11,382
pythondev
help
thing is, DRF already handles the transform to a dict
2019-02-28T07:15:06.075500
Hiroko
pythondev_help_Hiroko_2019-02-28T07:15:06.075500
1,551,338,106.0755
11,383
pythondev
help
so if something’s screwy there, its a pretty small edge case that IMO is not worth handling
2019-02-28T07:15:26.076000
Hiroko
pythondev_help_Hiroko_2019-02-28T07:15:26.076000
1,551,338,126.076
11,384
pythondev
help
so if you get an error returned from that, just toss back a 400 bad request error code
2019-02-28T07:15:43.076600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:15:43.076600
1,551,338,143.0766
11,385
pythondev
help
<@Rosetta> Lemme try your code on my machine
2019-02-28T07:17:07.077100
Valeri
pythondev_help_Valeri_2019-02-28T07:17:07.077100
1,551,338,227.0771
11,386
pythondev
help
So assume just wrap it into try except blocks, and that's all?
2019-02-28T07:17:47.077200
Faustina
pythondev_help_Faustina_2019-02-28T07:17:47.077200
1,551,338,267.0772
11,387
pythondev
help
I’d do a 400, not a 404
2019-02-28T07:18:59.077600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:18:59.077600
1,551,338,339.0776
11,388
pythondev
help
http spec says a 404 is not found
2019-02-28T07:19:09.078000
Hiroko
pythondev_help_Hiroko_2019-02-28T07:19:09.078000
1,551,338,349.078
11,389
pythondev
help
400 is bad request
2019-02-28T07:19:12.078200
Hiroko
pythondev_help_Hiroko_2019-02-28T07:19:12.078200
1,551,338,352.0782
11,390
pythondev
help
Yeah, just misspelled, meant 400
2019-02-28T07:19:22.078600
Faustina
pythondev_help_Faustina_2019-02-28T07:19:22.078600
1,551,338,362.0786
11,391
pythondev
help
:thumbsup:
2019-02-28T07:19:25.078800
Hiroko
pythondev_help_Hiroko_2019-02-28T07:19:25.078800
1,551,338,365.0788
11,392
pythondev
help
that’s the general idea, yes
2019-02-28T07:19:35.079200
Hiroko
pythondev_help_Hiroko_2019-02-28T07:19:35.079200
1,551,338,375.0792
11,393
pythondev
help
<https://stackoverflow.com/a/46493137/214892>
2019-02-28T07:20:27.079900
Hiroko
pythondev_help_Hiroko_2019-02-28T07:20:27.079900
1,551,338,427.0799
11,394
pythondev
help
I’d do what that answer says
2019-02-28T07:21:10.080300
Hiroko
pythondev_help_Hiroko_2019-02-28T07:21:10.080300
1,551,338,470.0803
11,395
pythondev
help
and you can see the code for ValidationError at <https://github.com/encode/django-rest-framework/blob/master/rest_framework/exceptions.py#L142-L158>
2019-02-28T07:21:20.080600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:21:20.080600
1,551,338,480.0806
11,396
pythondev
help
maybe ParseError would be better
2019-02-28T07:21:32.081100
Hiroko
pythondev_help_Hiroko_2019-02-28T07:21:32.081100
1,551,338,492.0811
11,397
pythondev
help
But now I'm kind of have another issue, I already have few try except cases, and if MaxmindError fails as wel, will it go to second except clause, and execute DataError?
2019-02-28T07:25:41.081300
Faustina
pythondev_help_Faustina_2019-02-28T07:25:41.081300
1,551,338,741.0813
11,398
pythondev
help
Will definetely looks at your examples
2019-02-28T07:25:48.081800
Faustina
pythondev_help_Faustina_2019-02-28T07:25:48.081800
1,551,338,748.0818
11,399
pythondev
help
No, exceptions don't chain like that
2019-02-28T07:27:28.082200
Jonas
pythondev_help_Jonas_2019-02-28T07:27:28.082200
1,551,338,848.0822
11,400
pythondev
help
In some cases this would be useful, but a single except clause is executed if an error occurs in the try block
2019-02-28T07:28:25.083300
Jonas
pythondev_help_Jonas_2019-02-28T07:28:25.083300
1,551,338,905.0833
11,401
pythondev
help
That's valid
2019-02-28T07:30:25.083700
Karoline
pythondev_help_Karoline_2019-02-28T07:30:25.083700
1,551,339,025.0837
11,402
pythondev
help
But you can chain few except with different errors, so I assumed that it should be valid
2019-02-28T07:30:56.084600
Faustina
pythondev_help_Faustina_2019-02-28T07:30:56.084600
1,551,339,056.0846
11,403
pythondev
help
It's valid syntax, but only one will fire as <@Jonas> said
2019-02-28T07:31:12.084900
Karoline
pythondev_help_Karoline_2019-02-28T07:31:12.084900
1,551,339,072.0849
11,404
pythondev
help
It's only useful in the case where you want to have different handling for different types of exceptions.
2019-02-28T07:31:34.085400
Karoline
pythondev_help_Karoline_2019-02-28T07:31:34.085400
1,551,339,094.0854
11,405
pythondev
help
So if I understand you correctly, it'll only fire MaxmindError, and misses all other except cases?
2019-02-28T07:33:00.086000
Faustina
pythondev_help_Faustina_2019-02-28T07:33:00.086000
1,551,339,180.086
11,406
pythondev
help
well, if it is a `DataError`, it will fire that.
2019-02-28T07:35:28.086500
Karoline
pythondev_help_Karoline_2019-02-28T07:35:28.086500
1,551,339,328.0865
11,407
pythondev
help
Let me check again
2019-02-28T07:35:53.086600
Wilhelmina
pythondev_help_Wilhelmina_2019-02-28T07:35:53.086600
1,551,339,353.0866
11,408
pythondev
help
(or the others as well, of course)
2019-02-28T07:36:04.086900
Karoline
pythondev_help_Karoline_2019-02-28T07:36:04.086900
1,551,339,364.0869
11,409
pythondev
help
But only one exception handler will be active
2019-02-28T07:36:55.087600
Hiroko
pythondev_help_Hiroko_2019-02-28T07:36:55.087600
1,551,339,415.0876
11,410
pythondev
help
I was going to mention some particulars around inheriting from other error classes and how that might effect this but I think that might needlessly confuse the issue :joy:
2019-02-28T07:39:36.089600
Karoline
pythondev_help_Karoline_2019-02-28T07:39:36.089600
1,551,339,576.0896
11,411
pythondev
help
<@Shawana> recording MPEG <http://take.ms/G9gU7> edit: not able to reproduce, maybe I'm doing something wrong ?
2019-02-28T07:40:42.089900
Wilhelmina
pythondev_help_Wilhelmina_2019-02-28T07:40:42.089900
1,551,339,642.0899
11,412
pythondev
help
I'm on `macOS 10.14.3 (18D109)`
2019-02-28T07:41:36.090300
Wilhelmina
pythondev_help_Wilhelmina_2019-02-28T07:41:36.090300
1,551,339,696.0903
11,413
pythondev
help
I'm kind of confused already, how to deal with it. So I assume I can wrap few exceptions in a single line, but again I'm returning creating in exception, so how to raise that exception message?
2019-02-28T07:44:27.090500
Faustina
pythondev_help_Faustina_2019-02-28T07:44:27.090500
1,551,339,867.0905
11,414
pythondev
help
You might need to rephrase the question - I'm not 100% sure what you are asking - but in your original code snipper - if there is a `MaxmindError` it will just return the value of `site.headers_set.create(request_data=request_data)`, but if there are any of `DataError, headers_model.DoesNotExist, ParseError`, it will raise a `ValidationError`
2019-02-28T07:46:09.091800
Karoline
pythondev_help_Karoline_2019-02-28T07:46:09.091800
1,551,339,969.0918
11,415
pythondev
help
could you test with another application open in the background - and with just clicking tthe two arrows twice after opening the app? sorry for inconvenience and thanks for your efford to help me!
2019-02-28T07:46:37.092300
Shawana
pythondev_help_Shawana_2019-02-28T07:46:37.092300
1,551,339,997.0923
11,416
pythondev
help
I might misunderstand the question, but you can just `try / except` blocks in the `except`
2019-02-28T07:47:17.093000
Yaeko
pythondev_help_Yaeko_2019-02-28T07:47:17.093000
1,551,340,037.093
11,417
pythondev
help
``` try: country_code = get_country_code(ip) except MaxmindError: try: return site.headers_set.create(request_data=request_data) except (DataError, headers_model.DoesNotExist, ParseError): raise serializers.ValidationError("human readable error message here") ```
2019-02-28T07:47:49.093500
Yaeko
pythondev_help_Yaeko_2019-02-28T07:47:49.093500
1,551,340,069.0935
11,418
pythondev
help
On a more high level, avoid using your database like a log file. If you want to persist user headers then log them, the overhead is a lot lower.
2019-02-28T07:49:24.094600
Jonas
pythondev_help_Jonas_2019-02-28T07:49:24.094600
1,551,340,164.0946
11,419
pythondev
help
sure
2019-02-28T07:51:20.096000
Wilhelmina
pythondev_help_Wilhelmina_2019-02-28T07:51:20.096000
1,551,340,280.096
11,420