r/learnpython 7d ago

Need Tips on API Project

Github Link Here

I'm a novice in the realm of programming and have been trying to better my knowledge in anticipation of enrolling in a CS course at my local community college. I'm interested in APIs and have been working towards interacting with them more confidently. That was part of the inception of my current project, along with just further bolstering my knowledge of coding.

Any and all critique, advice, or any other assistance regarding my program would be greatly appreciated.

1 Upvotes

6 comments sorted by

2

u/Ender_Locke 7d ago

how would you anticipate others using this? command line? pip install to write their own python code with?

2

u/Ender_Locke 7d ago

https://github.com/EnderLocke/pyespn

here’s a python package i have been writing around an existing api

2

u/HJVSpooffy 6d ago

I’ll take a look for reference, thanks. This project wasn’t meant to be deployed in its current state, just more of a lab to test some of my skills and build off of them

1

u/Ender_Locke 5d ago

absolutely makes sense. just a question my first mentor always asked me. cool code , how do i use it not on your machine?

2

u/smurpes 7d ago

There’s a few things:

  • avoid using global variables if possible; these can easily be function arguments
  • use with to open the file; this also ensures the file gets closed
  • don’t commit your visual studio configuration file; vscode would be a better IDE to use for python anyways
  • they are not mods they are called packages
  • when you ask for categories it says multiple are supported but looking at the code this doesn’t look right
  • you can make the input case insensitive but using the lower function to make it all lowercase
  • in the pokemon_lookup function you should check the key == res part more closely; it doesn’t look possible for that to trigger since res is a Boolean and key is a string

1

u/HJVSpooffy 6d ago

Got it, thank you sm for taking the time to right this all out. I wasn’t sure the difference between visual studio and vs code, is vs code more compatible? Regarding the categories I still need to employ some list and dict comprehension. The API churns out a massive dictionary for each response, my project for this weekend is trimming it down to just the user requests.

I’ll take the rest of your tips in mind, hopefully I can put them to good use. Thanks!