#🔒 would this be stupid?

8 messages · Page 1 of 1 (latest)

regal lake
#

i am writing some code to write code
and have made up this method

@endpoint(pickle.loads(b""))
def get_device_state(session, id: int) -> bool: ...

so instead of having to write the actual code i can do some implementation in the decorator handling all the edge cases
instead of serializing the meta data of the endpoint i just pickle it and load it from a literal bytes object
and i keep a ~ dummy definition as an interface

quiet trailBOT
#

@regal lake

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.

queen leaf
#

I don't quite understand what you're asking, but does the pickled data ever come from the client, or is it 100% always under the control of the server?

regal lake
queen leaf
#

I still don't understand, but nvm then. I was just going to point out safety concerns when using loads.

regal lake
# queen leaf I still don't understand, but nvm then. I was just going to point out safety con...

oh ye ik

let me reiterate
i have an endpoint defined in java
i want to use it from python
so i am translating it and i am keeping track of the following
parameters
does it need authentication, headers, what method it needs, under what name and what location are those parameters...
the first is needed to be visible for the user hence i put them in the dummy function
the rest is needed only to make the request and i have decided to pass it to a function that reads these "meta" data and make the appropriate request
before i was trying to decide the edge cases in advance and write code appropriatly per function
which approach is better?

quiet trailBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.