ReplAPI-it / ReplAPI.it-NodeJS

[DEPRECIATED] ๐™€๐™ซ๐™š๐™ง๐™ฎ๐™ฉ๐™๐™ž๐™ฃ๐™œ ๐™๐™š๐™ฅ๐™ก๐™ž๐™ฉ, ๐™–๐™ก๐™ก ๐™–๐™ฉ ๐™ฎ๐™ค๐™ช๐™ง ๐™™๐™ž๐™จ๐™ฅ๐™ค๐™จ๐™–๐™ก. This is the single most extensive Replit package, allowing you to access various parts of the site with just a few classes and methods. Maintained by @RayhanADev.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[REQUEST] ~ Autodoc or Full API

BD103 opened this issue ยท comments

commented

Is your feature request related to a problem? Please describe.
I'm (as you probably know) heading the Python version of this project. The docs show the Nextra tutorial and README.md only shows a minimal amount of features.

Describe the solution you'd like
Please update the docs or add autodoc so that I can support all of the features.

Additional context
I'm not very good with Nodejs, so that's why I can't just read the source. Sorry!

commented

@BD103 I'm working on writing up a collection of markdown files as documentation while Nextra is broken. I'll hopefully get it done sometime soon. In the meantime I can answer any questions you have?

commented

Yes, how exactly do you get the data from Replit? Do you use HTTP requests or GraphQL? If so, how do you grab the data with GraphQL? I've never used it before, and can't read the JS well enough to figure it out. @rayhanadev

commented

@BD103 I use HTTP Post requests to gather data. You can use the requests module and json module with following:

import json
import requests
url = "https://staging.replit.com"
headers = {
    'X-Requested-With': 'anythingoesherelol',
    'Referrer': 'https://staging.replit.com/'
}
body = {
	# This is the GraphQL Query
	'query': """
		query User($username: String!) {
			userByUsername(username: $username) {
				karma
			}
		}
	""",
	# These are the GraphQL Variables
	"variables":  json.dumps({
		"username": self.res['username'],
	})
}

# This is the response
res = json.loads(requests.post(url, data=body,headers=headers).text)
print(res)
commented

Why staging.replit.com?

commented

Two reasons
A. Overloading https://replit.com/graphql affects the main site which is not good (I accidentally did it once, Cloudflare blocked all requests, things went bad for everyone)
B. Staging is technically meant for this sort of thing semantically speaking

commented

@BD103 https://github.com/ReplAPI-it/API-Documentation I'll be writing the queries up here.

commented

Closing since resolved.