Share your repls and programming experiences

← Back to all posts
easy database
[deleted]

I will keep this up as long as I can and plan to update it every week.

I made a database for everybody to use:
How to use:

send a POST-request, with a dict like this: 
		{
			'key'	:	'name',
			'data'	:	{'put data here'}
		}
		and, to access it, send a GET-request, (x = 
                requests.get(database_link).json())
		and use x['the key you want to use'], and you will get the data

@Zavexeon suggested rate limiting of 100 requests a second. There is now rate limiting

Update 0.1:
Because somebody has to spam everything, you can now only send 3000 bytes at a time.

Request 0.1:
What should I add?

Edit: Wow guys, very funny. you spammed the db. Wow. My ears hurt

Commentshotnewtop
AdCharity (1315)

I assume data doesn't persist :(
Edit: 699 upvotes !?

[deleted]

@AdCharity it does persist. Im using uptime robot in order to keep up up.

[deleted]

@AdCharity 700th cycle giver

AdCharity (1315)

@TaylorLiang kind of sad it's not backed up but that's still really cool. also NOOOO MY 699 UPVOTES

ebest (635)

@AdCharity "cycles" does anyone know why upvotes are called that?

AdCharity (1315)

@ebest maybe because @amasad likes to bike

Highwayman (1358)

@ebest I’ve always thought of it this way: the amount of time a program is running can be measured in cpu cycles, so cycles are how much experience we have with the repl.it community. If you have been using repl.it for a super long time, but you haven’t really posted much, you’ll have an okay amount of cpu cycles, maybe 100 - 200, but if you are super active for the very short time you’ve been here, then you could have those 100-200 cycles. either way it shows that you at least know your way around the place. If you’ve been on here a short time with little to no activity, then you’ll have around 0, maybe 10 cycles, suggesting you essentially have absolutely no idea what’s going on right now or why there are check marks next to people’s posts to you question. Same could happen for someone who just doesn’t post at all: no cycles. Then there are people who have been here forever and are constantly posting who have massive amounts of cycles, 900 to over 1000 cycles, these are obviously the people who really know this site. They are very experienced. None of this is necessarily relates to coding skill. Just experience with repl.it, but still. Pretty cool.

all those ranges are fake, I have no idea what the actual numbers would be, those are just examples.

AdCharity (1315)

@Highwayman seems pretty accurate to me. Post it on learn

Highwayman (1358)

@AdCharity

Post it on learn

lol yes.

ebest (635)

@Highwayman Mention some other people who might be able to post this on announcements...
You know this place good enough. Are you a philosopher or a coder?

by cycle

Highwayman (1358)

@ebest Idk.. it’s just some food for thought, not really official repl.it stuff, right? So I’d be surprised if they did put it up there. That would be funny though lol.

Are you a philosopher or a coder?

yes.

You know this place good enough [...] by cycle

huh, I guess I do need to fix those numbers a bit..

ebest (635)

@Highwayman there was this intresting thing I did a while ago with Amelia Blackwell. I made 4 alternate accounts, cycling? every one of her comments. Nothing important. Don't look at your cycles.

Highwayman (1358)

@ebest 🤷‍♂️ Ok, but as a law abiding citizen, I do, because I know it is a true value for me, because I don’t tamper with it, and no one else cares about me enough to go around secretly upping my cycles.

ebest (635)

@Highwayman I read every one. How do you have so many comments? Confusion.

Highwayman (1358)

@ebest because I love this place. I live more on repl.it than I do in real life. This is my life. I guess that’s sad, but whatever I love these people. Everyone.

ebest (635)

@Highwayman I used to. Then school happened. And I still do, but homework plagues me every day.

My coding time became less and less, and I slowly disconnected from repl.it. I used to do so much, but now?

Highwayman (1358)

@ebest I’d say you’ve saved yourself lol. I’m still in school, but I can’t pull back. I still code at the expense of all my homework and all my grades.

Highwayman (1358)

@ebest sorry, can’t answer that.

ebest (635)

@Highwayman ok

oh no my info is contradictory

ebest (635)

@Highwayman in my name

it says I work

wait I do

do I?

Highwayman (1358)

@ebest

introducing:

the struggles of the average student coder:

Do I work?

ebest (635)

@Highwayman wait, I don't. I technically unofficially "volunteer" for repl.it egg rolls.

Or do I.

*We can neither confirm nor deny if I work. Do I? **

**existential crisis? (cross thingy here)

(cross thingy here) I broke

ebest (635)

@Highwayman google maps, may or may not still be there.

search up repl.it egg rolls google maps

AdCharity (1315)

@ebest @Highwayman stop clogging my notifications and talk on discord or something

AdCharity (1315)

@Highwayman Welp now you know where @ebest lives now

ebest (635)

@AdCharity Nearly. I'm [REDACTED] states away. I live in [REDACTED].

If only. I'd go there every day. I learned about this on the replit discord.

[deleted]

@ebest mmm, my favorite state, [REDACTED]

ebest (635)

@TaylorLiang Come to [REDACTED]! much fun included.

[deleted]

@ebest Were [REDACTED] miles away from [REDACTED]! perfect for vactions

MrEconomical (2225)

@AdCharity @TaylorLiang data actually does persist in programatically saved files in repls now if you have explorer mode enabled

[deleted]

@MrEconomical gimmie a sec

[deleted]

@MrEconomical ok data persits now

MrEconomical (2225)

@TaylorLiang if it crashes isnt the db variable reset

AdCharity (1315)

@MrEconomical doesn't this mean... that there is no need for external db anymore when you can make one on repl? :P

MrEconomical (2225)

@AdCharity yes... I make all my databases on repls

AdCharity (1315)

@MrEconomical gimme gimme I was trying earlier to make a db class but idk how to do it and make it synchronous

MrEconomical (2225)

@AdCharity why would you make a sync database

AdCharity (1315)

@MrEconomical either synchronized or using promises so I can save stuff and then do action (basically allow me to do .then(function(){}))

AdCharity (1315)

@MrEconomical
:/ you helped me with POST and I still use .then()
promises are cleaner, newer, and better and I still don't know how to use them

[deleted]

@MrEconomical yes. However, im useing uptime robot to make sure that it stays up

MrEconomical (2225)

@TaylorLiang repls restart every 24 hours, and also it might crash unexpectedly

Highwayman (1358)

@MrEconomical sorry to bother you on such an old post, but is this still true?

Warhawk947 (519)

@ebest ten years ago? seems legit...

[deleted]

@Warhawk947 bruh this thread is 3 months old

Warhawk947 (519)

@roylatgnail lol i just realized srry oof

[deleted]

@Warhawk947 bruh other people got the notification too.

Zexogon (873)

I’m boutta make some dope games with this just you wait

[deleted]

@Zexogon How dope?

Zexogon (873)

@TaylorLiang 37 turtles out of 5 cheeseburgers

Zexogon (873)

@TaylorLiang i just need to figure out how to use it xD

[deleted]

@Zexogon theres a mini-documation in the descriptoin though

DeBeast591 (134)

Can I use the code in my own projects and change where data is sent? I would leave credit. (NOTE: I probably would not do this, it's just a random question I have.)

[deleted]

@DeBeast591 Yes, and you dont have to credit me

Zavexeon (1029)

Neat! :3

Did you implement rate limiting?

[deleted]

@Zavexeon no.
How can do that?

[deleted]

@Zavexeon =( its blocked for me (io sites are blocked for me until 3:30)

Zavexeon (1029)

@TaylorLiang Oh.... wish I could help with the rate limiting but I don't know Python...

[deleted]

@Zavexeon
:thonk:

Zavexeon (1029)

@TaylorLiang Oh lol. Remember how I made the program that starts the groups for the MMH? I made like hundreds of
Python repls on my account while testing it.

[deleted]

@Zavexeon oh ok. I managed to unblock the readthedocs site. What do you think should be a good limit for rate limiting?

Zavexeon (1029)

@TaylorLiang Hmm... 100 requests a second?

[deleted]

@Zavexeon ok, I added rate limiting. Going to credit you for the idea

CodeSalvageON (574)

josh tf happened to you man

CodeSalvageON (574)

yo taylor why you gone off the face of the earth

Highwayman (1358)

I noticed this a while ago (obviously, I wouldn’t be looking now if I hadn’t lol) and I hadn’t really looked at the code.
Now I’ve seen your code.
And it is beautiful.
It is cleansing.
I’m not even kidding, I looked at this code, and they seemed to say to me "It is all right, everything will be okay. Useful things can be as small as 42 lines. Be at peace."
This has been life changing.

maazzubair99 (58)

what data types does it accept
like can i send an entire dict over, or just a single string

[deleted]

@maazzubair99 You can send any data type over so:

  • strings
  • dicts
  • lists/tuples/sets
AgastyaSandhuja (156)

I'm so confused how does this work

[deleted]

@AgastyaSandhuja You have to send post and get requests

#put info
import requests
requests.post('https://freeDB.taylorliang.repl.co', data = {
  'key'  : 'example',
  'data'  : {'hello'  : 'world'}
})

and in order to get {'hello' : 'world'} you do this:

import requests
requests.get('https://freeDB.taylorliang.repl.co').json()['example']
#we used the example for the key, so the word in the [] is the key
IzanLarumbe (33)

I accidentally took down the database, sorry

[deleted]

@IzanLarumbe what did you do? Just curious
edit: its also not down
its works

IzanLarumbe (33)

I don't know, i sent a request using html in the data part, and when i went the repl re-started.

@TaylorLiang

[deleted]

@IzanLarumbe repls restart every 24 hours (@mrEconomical said so), so you dont have to worry

IzanLarumbe (33)

Kinda hard to use, why don't you make it more interactive? Maybe adding folders and being capable of uploading files and selecting their category, for example:

You upload a txt file and you can classify it as "text files" (a folder) then the users who join the freeDB can enter in that folder and look at all the text files uploaded

Also you could make another app called "SendDB" in python to make the requests from your own app.

FreeDB/Text Files/MyFile.txt

Edit:

Basically its broken fix the code cuz i just dont know anything about fixing eof stuf..

[deleted]

@IzanLarumbe You need to close the request parentheses
its not broken, that code is, so the thing has to be is:

import requests
requests.post(link, data = {
  'key'  :  'I am God',
  'data'  : 'Sup!'
})
mkhoi (291)

Thank you, this seems very simple to use and it's free

[deleted]

@mkhoi If you also dont want people to edit your keys, you can fork it.

mkhoi (291)

@TaylorLiang So when i need to put stuff into the forked repl, i just use that repl's URL?

[deleted]

@mkhoi yes, you use the forked repl's url

Nettakrim (388)

can you have an example of some code that
posts "hello" to the database then
reads the "hello" then
prints it?

[deleted]

@Nettakrim

#this puts code
import requests
requests.post('https://freeDB.taylorliang.repl.co', data = {
  'key'  : 'example',
  'data'  : 'hello!'
}
#this reads the code
import requests
print(
  requests.get('https://freeDB.taylorliang.repl.co').json()['example']
)
Foster_Bryant (97)

How would I send a file's content to the db?

[deleted]

@Foster_Bryant

import requests
requests.post('https://freeDB.taylorliang.repl.co', data = {
  'key'  :  'the key you want',
  'data'  :  with open('file.txt'): f.read()
})

and you can get the data by doing this:

import requests
print(requests.get('https://freeDB.taylorliang.repl.co').json()['the key earlier'])
Foster_Bryant (97)

@TaylorLiang Am I able to send stuff to this database through different programs?

[deleted]

@Foster_Bryant Node.js also works, but I dont know how to do requests in that. As long as you can send requests in that program, it can work
lang's that I know have requests:

  • js
  • python
  • html
  • c#
  • c++ (with external library's)
Zavexeon (1029)

Just keep in mind that every time this restarts all the data is lost.

[deleted]

@Zavexeon what do you mean?

Zavexeon (1029)

@TaylorLiang Every time the database is restarted all the data in the dictionary is lost since it's stored in RAM.

[deleted]

@Zavexeon I see no downside. For me, its an easy way to remove the constant amount of spam it gets

MarcusWeinberger (579)

Also it appears to have crashed and lost all the data

[deleted]

@MarcusWeinberger No, somebody has just spammed it. I will update it for your sugestion, and make it save who ahem spammed the database

[deleted]

@MarcusWeinberger I had to reset it, because there was like 5 gigs of just raw spam in there

MarcusWeinberger (579)

Instead of returning the whole database, you should take the key as an argument in the url and send only the result

EnzoMines (10)
	{
		'key'	:	'name',
		'data'	:	{'put data here'}
	}
[deleted]

@AlexanderLanglo You have to send a post/get request
use request.get('https://freeDB.taylorliang.repl.co').json in order to get the info, at it will return {} (at the time of writing this)

use post requests to send data. In order to send a list, send this:

'key' : "the key you want"
'data' : ["the list you want to send"]
})

data can be anything

AlexanderLanglo (8)

@TaylorLiang im confused on where to send it, in the command line, url, or somewhere else?

[deleted]

@AlexanderLanglo You have to send a request. You can do this in python with the python request moudule.

AlexanderLanglo (8)

@TaylorLiang what do i put for params in request.post?

[deleted]

@AlexanderLanglo post's perams is
request.post(url, data = {})

PDanielY (1091)

Not to be mean, but this is actually so easy to hack into if you have the right tools

POKEBLOX6 (0)

I mean since it's using get requests yes, post request would be [email protected]

[deleted]

@PDanielY How can I make it more secure?