reddit

How do I integrate a HTML code in a Python Script?

你离开我真会死。 提交于 2020-01-03 10:24:04
问题 I have a Python code that creates a report for a data frame from Reddit, and converts it to simple HTML and then email's it out. Below is the code: #Clean all the Dataframes test_clean = clean(test_test_df) brand_clean = clean(brands_df) competitor_clean = clean(competitors_df) #Convert to HTML test_html = test_clean.render() brand_html = brand_clean.render() competitor_html = competitor_clean.render() # In[27]: brand_clean # # Email Integration # #### Import Libraries for Email # In[ ]:

How do I integrate a HTML code in a Python Script?

前提是你 提交于 2020-01-03 10:22:40
问题 I have a Python code that creates a report for a data frame from Reddit, and converts it to simple HTML and then email's it out. Below is the code: #Clean all the Dataframes test_clean = clean(test_test_df) brand_clean = clean(brands_df) competitor_clean = clean(competitors_df) #Convert to HTML test_html = test_clean.render() brand_html = brand_clean.render() competitor_html = competitor_clean.render() # In[27]: brand_clean # # Email Integration # #### Import Libraries for Email # In[ ]:

404 error when requesting json in Reddit API

爷,独闯天下 提交于 2020-01-03 06:42:29
问题 I'm trying to log into Reddit and get my own account data. This my Python code: from pprint import pprint import requests import json username = 'dirk_b' password = 'willnottell' user_pass_dict = {'user': username, 'passwd': password, 'api_type': 'json', 'rem': True, } headers = {'dirkie': '/u/dirk_b API python test', } client = requests.session() client.headers = headers r = client.post(r'http://www.reddit.com/api/login', data=user_pass_dict) j = json.loads(r.content.decode()); client

How to use a proxy with RedditSharp?

为君一笑 提交于 2019-12-25 06:44:58
问题 I'm using RedditSharp from https://github.com/SirCmpwn/RedditSharp in a script of mine, and I'm simply asking, when connecting using this how do I implement a proxy? and could I change the proxy midscript? 回答1: There no standalone way, you can't accomplish this without modifying this library source code. So most painless-way: Overload constructor of RedditSharp - add new argument with IWebAgent as type. So it will look like this: public Reddit() : this(new WebAgent()) { } public Reddit

How to use a proxy with RedditSharp?

一个人想着一个人 提交于 2019-12-25 06:43:28
问题 I'm using RedditSharp from https://github.com/SirCmpwn/RedditSharp in a script of mine, and I'm simply asking, when connecting using this how do I implement a proxy? and could I change the proxy midscript? 回答1: There no standalone way, you can't accomplish this without modifying this library source code. So most painless-way: Overload constructor of RedditSharp - add new argument with IWebAgent as type. So it will look like this: public Reddit() : this(new WebAgent()) { } public Reddit

Using Praw how do you get comment linked by a URL

喜夏-厌秋 提交于 2019-12-24 14:51:18
问题 I am trying to get the content linked to by a reddit URL, it could be a submission OR a comment, and I need to be able to get the corresponding object, does anyone know how to? 回答1: If you are using PRAW (it seems you are from this answer) you can simply use the get_submission function for either case. import praw r = praw.Reddit('<USER AGENT>') submission = r.get_submission('http://www.reddit.com/r/redditdev/comments/10msc8/how_to_calculate_more_comments_count_not_just/') comment = r.get

reddit not pulling scraping image on link post

谁说胖子不能爱 提交于 2019-12-24 09:17:01
问题 On link posts, the reddit scraper is not scraping an image from my site for a thumbnail and I cannot see why. I have followed any small snippet I could find about it which basically said. Use a squareish image, less than 1.5:1 ration on the sides. make the size as small as possible. link it with the open graph protocol http://ogp.me/ I have done all of these and added this in the html with no luck, and nowhere else to turn to. <meta property="og:image:secure_url" content="static/screenshot

a reddit-php-sdk method not outputting anything

淺唱寂寞╮ 提交于 2019-12-24 00:10:20
问题 I'm trying to learn reddit code and using this https://github.com/jcleblanc/reddit-php-sdk There's a method in this library $reddit->getUser() which outputs null always. Everything else seems to be working though. include_once("jcleblanc-reddit-php-sdk-4a4cc32/reddit.php"); $reddit = new reddit("my-username", "my-password"); $userData = $reddit->getUser(); var_dump($userData); outputs null . $response = $reddit->getListing("all", 5); var_dump($response); outputs what's expected just fine.

On Reddit, how do scripts get the number of upvotes and downvotes for a comment?

≡放荡痞女 提交于 2019-12-23 16:02:29
问题 On Reddit, people can post comments that get upvotes and downvotes. This information is not readily accessible on the page itself, so it seems that something like an API is used to gather this information. I found this script that does this, but am unable to determine where in the script it pulls this information from. Could someone point me to the relevant line where the script gets the data from? 回答1: Each comment has data attributes: <div class="thing id-t1_c4upmtm odd comment " onclick=

Reddit submit API 500 error

早过忘川 提交于 2019-12-23 03:39:16
问题 I'm attempting to use the reddit API to make posts, but the server is returning 500 errors. For example, I tried posting to this URL with my cookie set: http://www.reddit.com/api/submit?title=testtitle&sr=compsci&uh=<modhash_goes_here>&text=testtext&kind=self And my Chrome Dev Tools prints the following error: POST <my long URL goes here> 500 (Internal Server Error) I read somewhere on StackOverflow that you need both the modhash and the cookie, so that's what I'm using. I tried without the