I just made the most 50/50 script ever: it selects and opens random image URLs from 4chan (returns NSFW results like half of the time)
It's fun to run! Cause you *really* never know what's going to pop up. Run at your own risk though, cause it can return anything from cute kitten pictures, to not-unseeable NSFL pictures
#!/usr/bin/python3
#*************************************************************************************************************************
#IMPORTANT
#Don't remove the time.sleeps; which are in place to comply with 4chan's API rule of 'no more than 1 request per second'
#https://github.com/4chan/4chan-API
#
#This script selects a random images from 4chan, and opens them in web browser
#Requires the 'requests' module
#*************************************************************************************************************************
import requests,random,json,time,webbrowser
#Returns [ random image URL, random image's thread URL ]
def r4chan():
#List of 4chan boards
boards = ['a','c','w','m','cgl','cm','n','jp','vp','v','vg','vr','co','g','tv','k','o','an','tg','sp','asp','sci','int','out','toy','biz','i','po','p','ck','ic','wg','mu','fa','3','gd','diy','wsg','s','hc','hm','h','e','u','d','y','t','hr','gif','trv','fit','x','lit','adv','lgbt','mlp','b','r','r9k','pol','soc','s4s']
#Select a board
board = random.choice(boards)
#Request board catalog, and get get a list of threads on the board; then sleeping for 1.5 seconds
threadnums = list()
/r/Python
https://redd.it/ccrh6o
It's fun to run! Cause you *really* never know what's going to pop up. Run at your own risk though, cause it can return anything from cute kitten pictures, to not-unseeable NSFL pictures
#!/usr/bin/python3
#*************************************************************************************************************************
#IMPORTANT
#Don't remove the time.sleeps; which are in place to comply with 4chan's API rule of 'no more than 1 request per second'
#https://github.com/4chan/4chan-API
#
#This script selects a random images from 4chan, and opens them in web browser
#Requires the 'requests' module
#*************************************************************************************************************************
import requests,random,json,time,webbrowser
#Returns [ random image URL, random image's thread URL ]
def r4chan():
#List of 4chan boards
boards = ['a','c','w','m','cgl','cm','n','jp','vp','v','vg','vr','co','g','tv','k','o','an','tg','sp','asp','sci','int','out','toy','biz','i','po','p','ck','ic','wg','mu','fa','3','gd','diy','wsg','s','hc','hm','h','e','u','d','y','t','hr','gif','trv','fit','x','lit','adv','lgbt','mlp','b','r','r9k','pol','soc','s4s']
#Select a board
board = random.choice(boards)
#Request board catalog, and get get a list of threads on the board; then sleeping for 1.5 seconds
threadnums = list()
/r/Python
https://redd.it/ccrh6o
reddit
r/Python - I just made the most 50/50 script ever: it selects and opens random image URLs from 4chan (returns NSFW results like…
134 votes and 24 comments so far on Reddit
How to improve the structuring of three models for a financial portfolio website/
Trying to wrap my heard around a database structure for a financial portfolio web-app with multiple users allowed to view other portfolios. Here is what I've come up with so far for database design.
class Portfolio(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODELs, on_delete=models.CASCADE, related_name='portfolio')
category = models.CharField()
name = models.CharField(max_length=35)
about = models.CharField(max_length=200)
slug = AutoSlugField()
...
class PortfolioStocks(models.Model):
portfolio = models.ForeignKey(Portfolio.slug)
stock_list = ArrayField(models.CharField())
class PortfolioUsers(models.Model): #Important Note: this is not the User model
portfolio = models.ForeignKey(Portfolio.slug)
creator = models.ForeignKey(settings.AUTH_USER_MODEL)
admin_user = models.ManyToManyField()
guest_user = model.ManyToManyField()
/r/django
https://redd.it/lpf0sp
Trying to wrap my heard around a database structure for a financial portfolio web-app with multiple users allowed to view other portfolios. Here is what I've come up with so far for database design.
class Portfolio(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODELs, on_delete=models.CASCADE, related_name='portfolio')
category = models.CharField()
name = models.CharField(max_length=35)
about = models.CharField(max_length=200)
slug = AutoSlugField()
...
class PortfolioStocks(models.Model):
portfolio = models.ForeignKey(Portfolio.slug)
stock_list = ArrayField(models.CharField())
class PortfolioUsers(models.Model): #Important Note: this is not the User model
portfolio = models.ForeignKey(Portfolio.slug)
creator = models.ForeignKey(settings.AUTH_USER_MODEL)
admin_user = models.ManyToManyField()
guest_user = model.ManyToManyField()
/r/django
https://redd.it/lpf0sp
reddit
How to improve the structuring of three models for a financial...
Trying to wrap my heard around a database structure for a financial portfolio web-app with multiple users allowed to view other portfolios. Here...