These are chat archives for praw-dev/praw

22nd
Mar 2017
Bryce Boe
@bboe
Mar 22 2017 04:03
@D0cR3d you can turn on logging to see the endpoints that are hit along with timestamps for formatting.
Let me work out an example... I don't do this terribly often (the logging probably could use some love).
Bryce Boe
@bboe
Mar 22 2017 04:12
import logging

import praw
reddit = praw.Reddit('pyapitestuser2', user_agent='bboe test')

logging.getLogger('prawcore').setLevel(logging.DEBUG)
logging.getLogger('prawcore').addHandler(logging.StreamHandler())
logging.getLogger('prawcore').handlers[0].setLevel(logging.DEBUG)

list(reddit.front.hot())
Will output something like:
Fetching: GET https://oauth.reddit.com/hot
Headers: {'Authorization': 'bearer ...'}
Data: None
Params: {'limit': 100, 'raw_json': 1}
Response: 200 (5643 bytes)
By adding a formatter you can get the timestamps, and then you'll have to parse that data to collect the information you're looking for.
D0cR3d
@D0cR3d
Mar 22 2017 12:00
Gotcha, thanks. I'm familiar with logging, I was just afraid it would be a lot of terrible parsing.
arby
@rb_e2_twitter
Mar 22 2017 13:55
hi all
Just getting into PRAW and trying to find out what the limits are for return results i.e. 1000 or no limit? I seem to be getting inconsistent results for submission in subreddit.submissions(1485092192, 1490188980):
Bryce Boe
@bboe
Mar 22 2017 15:17
@D0cR3d once the custom requestor work is available you could do something similar to @elnuno's example to log the request URLs: https://github.com/elnuno/praw/blob/2787227f8f5fa6baf9d291c8dc8b4f76cfc5e1bb/docs/examples/json_debbuging_reddit.py
@rb_e2_twitter subreddit.submissions doesn't have a limit
It dynamically adjusts the timestamps to try to get all results.
Each individual search, that submissions relies upon, however, does have a limit.
John Fox
@classicyuppie
Mar 22 2017 16:36

I’m looking in the documentation and I don’t see anything that allows a message to be sent as a modmail notification that an action was taken by a bot and to please verify the action. Am I simply missing it?

Apologies if this isn’t the best place to ask - I’m new to python and PRAW.

arby
@rb_e2_twitter
Mar 22 2017 18:18
Thanks @classicyuppie
I'm only getting about a months worth of data
I might have to do it chucks
Slaiyn
@Slaiyn_twitter
Mar 22 2017 18:31
hi everyone
arby
@rb_e2_twitter
Mar 22 2017 18:32
Hi
Slaiyn
@Slaiyn_twitter
Mar 22 2017 18:39

I have a problem with installing the praw module and I don't know if this is the right place to post it. After several other issues I installed a brand new version of Kubuntu 16.10. Then I installed pip: sudo apt-get install python-pip. Next I installed the package "requests" with pip, started the python 3.5 shell (python3) and tried importing it. This worked. Next, I used the command: pip install praw. It said "successfully installed praw-4.4.0...". When trying to import this package I get the following error: ImportError: No module named 'praw'. This seems very unlogical to me because pip freezeshows praw. I have tried googling and a complete reinstall of kubuntu to no avail.

Thank you for your help / redirecting me in advance.

Bryce Boe
@bboe
Mar 22 2017 19:10
Maybe you only have pip for python3, but you might be running python2.
If you open the python3 repl by just running python3 and then writing import praw what do you get?
@classicyuppie how do you do this normally through the web interface?
You can send a message as a subreddit, if that's what you mean.
John Fox
@classicyuppie
Mar 22 2017 19:12
Basically what I want to do is have my bot post a response to a comment, and then in certain cases, I want to pass a message through to modmail to alert the mods to take action.
Levi Roth
@leviroth
Mar 22 2017 19:12
Conversely, if you mean to notify the moderators of the subreddit, you ought to be able to send an ordinary message to the subreddit and have it go to modmail
John Fox
@classicyuppie
Mar 22 2017 19:12
^
Bryce Boe
@bboe
Mar 22 2017 19:12
reddit.user('username').message('subject', 'body', from_subreddit='name of sub')
John Fox
@classicyuppie
Mar 22 2017 19:12
Got it.
Bryce Boe
@bboe
Mar 22 2017 19:13
@classicyuppie sounds like you need to reply, and then send a modmail.
Is it clear how to proceed?
John Fox
@classicyuppie
Mar 22 2017 19:13
That’s accurate, but I’d like it to be a modmail notification, not just a message to modmail. I’m not sure if that’s only allowed through using Automoderator though.
Levi Roth
@leviroth
Mar 22 2017 19:14
Off the top of my head, I believe the "notifications" are reserved for messages from modmail
err
from AutoModerator
Bryce Boe
@bboe
Mar 22 2017 19:14
If you can do it through the browser then PRAW should be able to do it, but if you don't know how to do it through the browser then it's not likely something that can be done via any API client.
John Fox
@classicyuppie
Mar 22 2017 19:15
That clarification helps quite a bit @bboe and @leviroth.
Thank you both!
Bryce Boe
@bboe
Mar 22 2017 19:15
You're welcome.
Slaiyn
@Slaiyn_twitter
Mar 22 2017 19:18

@bboe Here is a copy of my console '''nils@nilspc:~$ pip freeze
praw==4.4.0
prawcore==0.8.0
pygobject==3.22.0
requests==2.13.0
update-checker==0.16
nils@nilspc:~$ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.

import praw
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'praw'

'''

excuse the bad formatting
```nils@nilspc:~$ pip freeze
praw==4.4.0
prawcore==0.8.0
pygobject==3.22.0
requests==2.13.0
update-checker==0.16
nils@nilspc:~$ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.

import praw
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'praw'

```

Levi Roth
@leviroth
Mar 22 2017 19:35
@Slaiyn_twitter what is the output of pip -V?
Slaiyn
@Slaiyn_twitter
Mar 22 2017 19:36
@leviroth pip 9.0.1 from /home/nils/.local/lib/python2.7/site-packages (python 2.7)
huh, this seems to be pip for python2 doesn't it?
Levi Roth
@leviroth
Mar 22 2017 19:37
yep!
I think apt-get install python3-pip would get you the py3 version on Ubuntu
then invoke it with pip3
Slaiyn
@Slaiyn_twitter
Mar 22 2017 19:38
I'll give that a try, thanks. I'm kind of confused that I can import the package "requests" that I installed with pip
wow, that's it! I think I installed the wrong pip3 on my old machine because I gave that a try yesterday. Thank you very much for your help.
Levi Roth
@leviroth
Mar 22 2017 19:42
You're welcome.
@bboe I think I snuck in an edit as you were replying to my comment. Wondering if it would be better to add a very basic ModmailConversation.parse so that we can keep using _info_path.
Bryce Boe
@bboe
Mar 22 2017 20:28
@leviroth yeah that's a good idea too.
arby
@rb_e2_twitter
Mar 22 2017 20:44
@bboe I have a question on the timestamp submission get
Am I being limited to one months of data even if I want more?
for submission in subreddit.submissions(1485092192, 1490188980): this only give's me one months of data
D0cR3d
@D0cR3d
Mar 22 2017 22:01
@leviroth and @classicyuppie you just set the subject to include [Notification] and it will get routed to the New Modmail's notifications folder
Bryce Boe
@bboe
Mar 22 2017 22:03
@rb_e2_twitter you shouldn't be unless Reddit changed things. Does the subreddit have more data?
How many results are you getting?
D0cR3d
@D0cR3d
Mar 22 2017 22:05
Example of [Notification] in the subject which reddit routs to notification folder: https://i.imgur.com/eFuPF0s.png
arby
@rb_e2_twitter
Mar 22 2017 23:14
@bboe roughly a month. It ranges from 400 to 1500 depending on the sub I run it against
but I know there is data