#🔒 how to learn a library

99 messages · Page 1 of 1 (latest)

strange sinew
#

how do I learn a library? I got the past the basics of Python about 2 months ago and I just can't understand how to learn a library/module. it hurts my head so bad, and idk if I'm stupid or not but this documentation stuff doesn't make any sense. This stuff is seriously a headache bc idk how to learn this stuff.

dreamy sluiceBOT
#

@strange sinew

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

buoyant topaz
#

What library/module do you want to learn

strange sinew
#

sockets

#

and I was trying requests too

rich rover
strange sinew
rich rover
buoyant topaz
#

You can also use help() in your code to print out what a function does like this:
import x
help(x.something)

strange sinew
#

the documentation is hard to understand for me

#

i might be low iq

#

this stuff is so hard

rich rover
strange sinew
#

i went on the sockets documentation

#

read like 5 functions

#

and didnt understand anything

buoyant topaz
#

The documentation is technical, you'll get used to it over time.
Have a look at some videos explaining how to use it maybe but make sure you are trying to use parts of it that you have learned

rich rover
strange sinew
#

then

rich rover
strange sinew
crystal hedge
#

if you really don't understand it, you might not have as solid a foundation as you initially thought

#

can you point to a specific thing you don't understand?

crystal hedge
#

show us a function you read and don't understand

strange sinew
#

specific function or?

strange sinew
#

give me a sec

strange sinew
# crystal hedge show us a function you read and don't understand

AF_PACKET is a low-level interface directly to network devices. The addresses are represented by the tuple (ifname, proto[, pkttype[, hatype[, addr]]]) where:

ifname - String specifying the device name.

proto - The Ethernet protocol number. May be ETH_P_ALL to capture all protocols, one of the ETHERTYPE_* constants or any other Ethernet protocol number.

pkttype - Optional integer specifying the packet type:

PACKET_HOST (the default) - Packet addressed to the local host.

PACKET_BROADCAST - Physical-layer broadcast packet.

PACKET_MULTICAST - Packet sent to a physical-layer multicast address.

PACKET_OTHERHOST - Packet to some other host that has been caught by a device driver in promiscuous mode.

PACKET_OUTGOING - Packet originating from the local host that is looped back to a packet socket.

hatype - Optional integer specifying the ARP hardware address type.

addr - Optional bytes-like object specifying the hardware physical address, whose interpretation depends on the device.

#

like what does this even mean

#

AFPacket

crystal hedge
#

I personally don't know anything about sockets so can't really answer you there 😦

strange sinew
#

do you know anything about requests

#

bc that is also so hard for me to understand

#

maybe this just aint for me idk i might quit

crystal hedge
#

very little

#

what are your goals with python?

#

you don't need to know every single library

#

I've been using python 6+ years and don't know requests or sockets

strange sinew
#

i want to do reverse engineering eventually but i was just learning python bc someone recommended me to start with that, but I was going to try to learn networking and some web scraping with it aswell

#

ik reverse engineering is like C++/C and assembly

buoyant topaz
#

If you have just started, make sure you know the basics before jumping into the more advanced stuff. Also train your logic by building small projects or doimg challenges, otherwise you'll get overwhelmed and then get stuck.

strange sinew
crystal hedge
#

2 months is not a lot of time to have spent learning python

strange sinew
#

thats when i understood all the basics, i've been learning python for 4 months

#

but still not too long

crystal hedge
#

have you learned OOP?

strange sinew
#

nah

#

wait

crystal hedge
#

I'd recommend that first then

strange sinew
#

object oriented programming?

crystal hedge
#

yes

strange sinew
#

yes ik that

#

this stuff is genuinely so hard

#

how do you guys do this

crystal hedge
#

practice

#

dedication

#

research

#

curiosity

strange sinew
#

like bro the os module was so easy then i started working with

#

sockets

#

and idk what anything means

#

how is it so hard

fallow elk
#

I don't think any of us goes to read the actual docs, as in, the whole document of all functions etc etc. More finding out how to do certain things. See if there are any examples in the docs is usually your first bet. The "Getting Started" section if they have one. After that, you can look for specific function names, they should be named appropriately. (example for pandas: read_csv() will, read a csv.. etc)

crystal hedge
glad ice
# strange sinew like what does this even mean

sockets are pretty complicated, but overall when using a library for something, you must understand how that "something" works before you try to touch the library at all

For example, if you didn't know how multiplication works, you would not be able to create nor even use a calculator - it's the same for more complicated computer things, you must learn it conceptually first before using tools built around those concepts

fallow elk
#

After you get some basic knowledge and a sample setup, which does not entirely do what you want but at least something is working. You start to find out how you can tweak it for what you really need.

strange sinew
glad ice
#

a little but not really, requests requires for you to understand how HTTP and HTTPS works, not necessarily html/css

strange sinew
glad ice
#

Yes.
You'll likely want to test what you have learned in requests as soon as you learn it, but strictly speaking, you'll have to learn it before you actually use it

crystal hedge
#

most knowledge doesn't have a definitive start and end, so you just need to know enough to get started

strange sinew
glad ice
#

look up something like Introduction to REST APIs

strange sinew
#

whats an api

glad ice
#

yep, that's precisely why you are having a hard time with requests

strange sinew
#

like stuff like that just makes me feel so stupid

crystal hedge
glad ice
#

did you even try looking up a tutorial for requests on google/youtube?

glad ice
#

and it did not mention apis?

strange sinew
#

no

#

they were just doing explaining diff types of requests like get requests, post, etc

#

and status code

#

all that

hardy steppe
#

If you want to work with sockets you should read a general introduction to network programming. The sockets module docs aren't enough, they assume you're already familiar with the idea of sockets.

The best guide on this I know is https://beej.us/guide/bgnet/html/split-wide/, although it's in C the sockets interface is similar in Python so it should still be useful.

Alternatively, read https://docs.python.org/3/howto/sockets.html and https://realpython.com/python-sockets/

In this in-depth tutorial, you'll learn how to build a socket server and client with Python. By the end of this tutorial, you'll understand how to use the main functions and methods in Python's socket module to write your own networked client-server applications.

glad ice
buoyant topaz
#

That's why, you aren't stupid you just haven't heard of apis. Look into them first

glad ice
#

I'd recommend looking into requests before sockets, but +1 for realpython - it also has a tutorial for requests, https://realpython.com/python-requests/

In this tutorial on Python's Requests library, you'll see some of the most useful features that Requests has to offer as well as ways to customize and optimize those features. You'll learn how to use requests efficiently and stop requests to external services from slowing down your application.

crystal hedge
#

Networking and sockets are large subjects. Literal volumes have been written about them. If you’re new to sockets or networking, it’s completely normal if you feel overwhelmed with all of the terms and pieces.

#

from that article

strange sinew
strange sinew
glad ice
dreamy sluiceBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.