mat-1 / repl-talk-api Goto Github PK
View Code? Open in Web Editor NEWAllows you to do various things with the slightly unofficial Repl.it Repl Talk API
Home Page: https://pypi.org/project/repltalk/
License: MIT License
Allows you to do various things with the slightly unofficial Repl.it Repl Talk API
Home Page: https://pypi.org/project/repltalk/
License: MIT License
The get_comments()
function for a user object doesn't work and returns a Traceback error stating that 'type' object is not iterable
.
Traceback:
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/__init__.py", line 814, in get_comments
_comments = await client._get_user_comments(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/__init__.py", line 1182, in _get_user_comments
return await self.perform_graphql(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/__init__.py", line 966, in perform_graphql
'query': str(query)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 89, in __str__
output = 'query ' + str(self.field)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 67, in __str__
value = builtin_to_graphql(value)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 7, in builtin_to_graphql
value = str(item)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 72, in __str__
output += str(value)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 53, in __str__
output += str(item)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 72, in __str__
output += str(value)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 67, in __str__
value = builtin_to_graphql(value)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 7, in builtin_to_graphql
value = str(item)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/graphql.py", line 65, in __str__
for field in item:
TypeError: 'type' object is not iterable
Code snippet that led to error:
replit = repltalk.Client()
try:
user = await replit.get_user(name)
posts = await user.get_posts(limit=5, order='new')
comments = await user.get_posts(limit=5, order='new')
except Exception as e:
print(e)
Add support for
Reading/writing comments on spotlight
Reading/adding reactions on spotlight
Getting repl description, maybe cover image
Read hashtags on spotlight
View all repls in a specific topic (hashtag)
Get the list of "Replit Picks"
Also will whitelisted_bots
be fixed?
Hi @mat-1 I'm so sorry to keep bothering you but, I'm just confused why get_reports()
is returning Post
s and Comment
s instead of the actual Report
. How do I get the Report
from the Post
?
I had this code working for some time to get the avatar of the repl owner (for which my repl is running in)
from repltalk import Client
import asyncio
async def get_repl_avatar(user_name):
user = await Client().get_user(user_name)
return user.avatar
def main():
# replit avatar
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
global repl_avatar
repl_avatar = loop.run_until_complete(get_repl_avatar(os.environ['REPL_OWNER']))
Essentially await Client().get_user(user_name)
never completes.
Today it stopped working. Any idea why or do know a better way to get the avatar url?
I have the code:
import repltalk, asyncio
client = repltalk.Client()
async def getComments():
for comment in await client.get_all_comments(order='new'):
print(comment)
print(asyncio.run(getComments()))
And when i run it, I get the error:
Traceback (most recent call last):
File "main.py", line 9, in <module>
print(asyncio.run(getComments()))
File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "main.py", line 6, in getComments
for comment in await client.get_all_comments(order='new'):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/repltalk/__init__.py", line 1232
, in get_all_comments
for c in _comments['items']:
TypeError: list indices must be integers or slices, not str
I don't know if I am just doing it wrong or it is an error on your end. Can you have a look please.
When doing async for report in await client.get_reports(resolved=False):
multiple times, the get_reports()
does not reset its list of reports for each loop, this results in an outdated and duplicated reports list being returned.
This is what I'm talking about:
As you can see, for each loop, the length of the list being returned by get_reports()
increases by 4 (the number of actual unresolved reports). Btw the lst
variable is getting reset correctly each loop.
Add doc strings + type hinting,
I can do this sometime
REEEEEE
checklist:
Even though it isn't known if the AMA board will stay up/active forever, it would be nice for it to be accessible through the API.
So, this isn't an issue more like a feature request. There should be a async function on posts to get the people that upvoted the post and it should return like an array of people that upvoted. I will try to make a pull request for this if I can get it to work but do you think you can add this to the repl-talk-api? @mat-1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.