Giter VIP home page Giter VIP logo

coffee-fueled-deadlines / osrsbytes Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 13.0 183 KB

OSRSBytes is an all-in-one Python library for Old School Runescape (OSRS) that features Item Information Lookup, OSRS Hiscores, and Grand Exchange Market information.

License: Eclipse Public License 2.0

Python 100.00%
osrs osrs-api old-school-runescape old-school-runescape-api runescape runescape-api python osrsbytes osrs-hiscores osrs-ge

osrsbytes's Introduction

CFDeadlines

Hello, I make things and they sometimes work and sometimes people use them.

Anurag's GitHub stats

Current Projects that Matter

osrsbytes's People

Contributors

coffee-fueled-deadlines avatar haran avatar rileyfitz avatar tylersweat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

osrsbytes's Issues

Remove Hiscores Caching

I do not believe that caching is currently being used in anything with OSRSBytes and in hindsight, it appears to be a pretty silly implementation on my part.

The purpose of OSRSBytes is to provide updated information and caching makes the seem kind of redundant. Developers using OSRSBytes can either implement their own caching if they still need it or write code that doesn't hit the API a thousand times.

Regardless, caching was a mistake and hasn't received love on my part so I'm removing it.

Entire bot crashes with any OSRSBytes error

Note: I'm on mobile

I'm running your package for my discord.py bot. At the smallest error, an exception is thrown and my whole bot is closed. The errors I've encountered are: a misspelled/nonexistent account lookup and when I misspelled a skill name.

Both times an exception was thrown and the bot is closed before I can see what the error is.

bug: getXPToNextLevel returns negative if player reaches 200m xp

Expected Behavior
Calling getXPToNextLevel after a player has reached 200m xp should return 0.

Actual Behavior

    def test_lookup(self):
        userName = 'Lynx Titan'
        skill = 'attack'

        actual = getXPToNextLevel(skill, userName)
        expected = 0
        assert actual == expected

Pytest output

E       AssertionError: assert -185608840 == 0

Smithing.json requires completion

Smithing.json (located in OSRSBytes/Modules/Smithing.json) is incomplete and requires completion. Ensure that when/if completing it that you follow the pattern already put into place in the Bronze section of the JSON file.

hiscores indexing issues:

I've noticed that whilst running a for through each boss name in the dictionary provided in the code, everything after obor shifts one index to the right.

After debugging, I found that this may be due to the phantom muspah update has caused an issue in indexing when calling onto the osrs hiscores api.

Pypi hosting bugged v1.2.3

Pypi is still hosting v1.2.3, and this includes the bug from issue #8 . This makes the instructions on the README.md of how to install and upgrade moot to receive the newest version of 1.2.4 with the bug fixes for Hiscores modules, and version corrections.

The only way to obtain a working copy of this repo then is to install from source.

Fix

Please update the Pypi package to v1.2.4

{api} APIDown Error

Line 89 of Items.py throws an error if it ever tries to execute as api is no longer a defined name after we made the api default to the wiki instead of being specified.

Total info showing incorrect XP

I will raise a PR to fix this. Total is showing 160973243\n224935 for XP instead of just 160973243

print (subset['total'])
{'rank': '199457', 'level': '2058', 'experience': '160973243\n224935'}

New Hiscores API update | Bosses list

Hi, there's a new bug again. Jagex added Artio, Calvar'ion and Spindel to the hiscores. Here is the updated self.__bosses list:

self.__bosses = [
"rifts_closed",
"abyssal_sire",
"alchemical_hydra",
"artio"
"barrows_chests",
"bryophyta",
"callisto",
"calvar'ion",
"cerberus",
"chambers_of_xeric",
"chambers_of_xeric_challenge",
"chaos_elemental",
"chaos_fanatic",
"commander_zilyana",
"corporeal_beast",
"crazy_archaeologist",
"dagannoth_prime",
"dagannoth_rex",
"dagannoth_supreme",
"deranged_archaeologist",
"general_graardor",
"giant_mole",
"grotesque_guardians",
"hesporti",
"kalphite_queen",
"king_black_dragon",
"kraken",
"kreearra",
"kril_tsutsaroth",
"mimic",
"nex",
"nightmare",
"phosanis_nightmare",
"obor",
"phantom_muspah",
"sarachnis",
"scorpia",
"skotizo",
"spindel",
"tempoross",
"gauntlet",
"corrupted_gauntlet",
"theatre_of_blood",
"theatre_of_blood_hard",
"thermonuclear_smoke_devil",
"tombs_of_amascut",
"tombs_of_amascut_expert",
"zuk",
"jad",
"venenatis",
"vetion",
"vorkath",
"wintertodt",
"zalcano",
"zulrah"
]

Cleanup Hiscores Code

Cleaning up the Hiscores code. There are a lot of methods and code in there that was written when I was either underexperienced or trying something new. I'm going to rewrite it in a cleaner way prior to pushing to pypi with version 1.3.0

Refactor Hiscores Package

Hiscores Package contains some private method implementations that use a single underscore (_) instead of double underscore (__ ). This isn't a huge issue but it's kind of unprofessional and an improvement I'd like to make. If someone wants to do this, it's not a lot of hard work, just ensure that it works when you're done with it. If not I have no issue doing this myself at a later date.

Items module broken from dead API

The Items module does not currently work as the RSBuddy API is broken and currently serves and incomplete JSON response.

I already created a solution by using the RS Wiki API which serves almost the same content. It also fits into the existing model of Items with no conflicts.

I understand I did this process backwards, but still wanted to create an issue as such.

Fletching.json requires completion

Fletching.json file (located in OSRSBytes/Modules/Fletching.json) is incomplete and requires completion. This file hasn't been started yet. Take a look at the Smithing.json file to get an idea for how it should be laid out.

Items.py Caching is slower than Uncached Version

In OSRSBytes/Items.py on the dev branch, the new shelving method of caching information is much slower than the uncached version. Upon further research, apparently shelving is a bad method of caching large dictionary values. Instead, it may be worthwhile to look into implementing a SQLite3 caching method instead for the item section of this project.

Refactor Items Package

Items Package contains some private method implementations that use a single underscore (_) instead of double underscore (__ ). This isn't a huge issue but it's kind of unprofessional and an improvement I'd like to make. If someone wants to do this, it's not a lot of hard work, just ensure that it works when you're done with it. If not I have no issue doing this myself at a later date.

Problem with library

This is most likely a problem with the website, but it shows rune dagger price as 0. All other prices are normal though.

Reading HCIM stats requires arg HIM but error message says to use HIC

When attempting to read stats for a hardcore, the correct argument for account type is 'HIM' (found by reading through source). But, the build-in error message when calling the function with no account type argument says to use the 'HIC' for a hardcore, which is not a correct argument for any account type and will just throw the same error. The error message and source need to be made to match.

Additionally, neither HIC or HIM is intuitive to use. The official game mode is called HCIM.

Items.update() missing from latest PyPI build

Hi

The Items() class is missing the update() method in the

image

I had a look at the OSRSBytes library thats installed in my virtual environment and it's missing the update method:

image

The Items.py file in the main and dev branch all have this method though and adding the snippet from the repo to the Items.py file in my virtual environment fixed this issue.

I installed the OSRSBytes library by running the pip install command

upgrading, uninstalling and reinstalling using pip did not fix the issue

I am running version 1.3.0 of OSRSBytes

Thanks,

bug: Spaces in a name are unsupported

Expected Behavior
The consumer is attempting to access a user with a space in their name

from OSRSBytes import Hiscores
userName = 'Lynx Titan'
user = Hiscores(userName)

The consumer should receive the User object associated with that username's high scores.

Actual Behavior
The library does not sanitize the username and directly passes in Lynx Titan (with a space) which results in an invalid URL.

Possible Solutions

  1. self.username.replace(' ', '%A0')
  2. Use a library to sanitize HTTP url

Stack Trace

    user = Hiscores(userName)
..\..\appdata\local\programs\python\python38-32\lib\site-packages\OSRSBytes\Hiscores.py:106: in __init__
    self._getHTTPResponse()
..\..\appdata\local\programs\python\python38-32\lib\site-packages\OSRSBytes\Hiscores.py:196: in _getHTTPResponse
    conn.request("GET", "/m=hiscore_oldschool/index_lite.ws?player={}".format(self.username))
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1230: in request
    self._send_request(method, url, body, headers, encode_chunked)
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1241: in _send_request
    self.putrequest(method, url, **skips)
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1092: in putrequest
    self._validate_path(url)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.