Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added another code example to the readme #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ybn4aq
Copy link

@ybn4aq ybn4aq commented Nov 28, 2023

As a beginner to this wrapper and the API, I found the lack of documentation for using this API in Python to be very anti-beginner friendly, so I decided to add another use case example to the readme.

Copy link
Contributor

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I am not a maintainer here, just a user and casual contributor of this package.

@@ -68,6 +68,19 @@ games_message.ParseFromString(byte_array) # Fills the protobuf message object wi
games = games_message.games
```

Note that depending on what type of query you're doing, you will need to parse it differently. Consider the following example of getting covers with a Protobuf API request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that depending on what type of query you're doing, you will need to parse it differently. Consider the following example of getting covers with a Protobuf API request:
> **Note**
> Depending on what type of query you're doing, you will need to parse it differently.
> Consider the following example of getting covers with a Protobuf API request.

@@ -68,6 +68,19 @@ games_message.ParseFromString(byte_array) # Fills the protobuf message object wi
games = games_message.games
```

Note that depending on what type of query you're doing, you will need to parse it differently. Consider the following example of getting covers with a Protobuf API request:
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```py

covers_message.ParseFromString(byte_array)
covers = [cover.url for cover in covers_message.covers]
```
You may need to do some digging around in igdbapi_pb2.py (being careful not to actually edit anything) to look for similar functions to GameResult() and CoverResult() based on what you are trying to query for.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the final sentence is necessary or valuable. It is quite common to have to look through source code of various packages, especially ones that aren't so popular such as this one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that this was necessary, especially considering my Python linter in VS Code did not pick up on GameResult() or CoverResult().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I don't think any IDE would pick those up because of how they're added to the python globals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants