halcy / Mastodon.py

Python wrapper for the Mastodon ( https://github.com/mastodon/mastodon/ ) API.
MIT License
867 stars 150 forks source link

docs? getting started issue / UX #374

Open BMaxV opened 3 months ago

BMaxV commented 3 months ago

Hello there,

I wanted to play around with the api a bit and thought I would use this module.

It doesn't really work for me out of the box, might be a "me" issue, but the documentation / errors don't immediately help fix this myself. So I thought I'd write a friendly issue to let you know, without any expectation that you fix this for me or anything.

:)


If I follow these getting started steps:

https://mastodonpy.readthedocs.io/en/stable/index.html

I get

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

this error, I'm not sure what's happening here.

I also found this guide:

https://martinheinz.dev/blog/86

Which mentions access tokens. Registering an application on my user profile on the web client and copy pasting that access token into something like this:

m = Mastodon(access_token="MYACCESSTOKEN", api_base_url="https://myinstance.websomething")
r = m.timeline("home",limit=10)
for x in r:
    print(x['id'])
    print(x['created_at'])
    print(x["content"])

works. So I'm assuming connection / login worked, I'm not sure how private the home feed is, but it should be personalized, so this is kind of what I was looking for.


So if you have the time and nothing better to do on this nice spring/summer weekend, which I hope you do, maybe take a look at those very first getting started steps and make sure they are more "idiotproof" for people like me. ;)

But what I have does work and it's using your software. So thank you for this software!

codl commented 2 months ago
socket.gaierror: [Errno -3] Temporary failure in name resolution

I'm not sure what's happening here.

This means that your system's DNS was not working at the time, perhaps you were offline, or your ISP's DNS was having a bad day. If the other snippet worked then I guess the problem was fixed by then.