Open ImFaisalKhalid opened 1 year ago
@ianklatzco
i've added some more issues ^^
i think it would be cool if this were a full-featured client!
what precisely does that mean?
# for example,
def resolveHandle(self,username): # aka getDid
headers = {"Authorization": "Bearer " + self.ATP_AUTH_TOKEN}
resp = requests.get(
self.ATP_HOST + "/xrpc/com.atproto.identity.resolveHandle?handle={}".format(username),
headers=headers
)
return resp
A cleaner API would look like something like:
class BskyResponse():
# blah blah blah
def __init__():
self.response = None
def resolveHandle(self, username0:
headers = #blahblahblah
resp = requests.get(blahblahbla)
rrrr = BskyResponse()
rrrr.response = resp
It would also be cool if there were a decorator in front of each def
that made it so we didn't need to put headers
in every function manually.
I don't know if this fits what you're thinking, but @thearchduke was able to write a codegen script from the Lexicons in the ATProto repository to generate Ruby classes for each Lexicon. Something similar could probably work in Python
https://github.com/ShreyanJain9/bskyrb/blob/main/lib/bskyrb/codegen.rb
something like this? https://github.com/jbn/psychonaut/blob/main/psychonaut/lexicon/codegen.py
yeah! psychonaut's approach is super cool (codegen). i think it would be super cool / instructive / good learning to do that here too.
Hey Ian,
You asked me to file an issue asking for TODOs - do you have anything in mind?