prunplanner / fio_wrapper Goto Github PK
View Code? Open in Web Editor NEWFIO API wrapper. Access Prosperous Universe game data in Python.
Home Page: https://prunplanner.github.io/fio_wrapper/
License: MIT License
FIO API wrapper. Access Prosperous Universe game data in Python.
Home Page: https://prunplanner.github.io/fio_wrapper/
License: MIT License
Allow users to search for planets by calling FIO endpoint /planet/search
with a POST request: https://doc.fnar.net/#/planet/post_planet_search
fio.Planet.search()
with search parameters passed{
"Materials": [
"FEO",
"LST"
],
"IncludeRocky": true,
"IncludeGaseous": true,
"IncludeLowGravity": true,
"IncludeHighGravity": false,
"IncludeLowPressure": true,
"IncludeHighPressure": false,
"IncludeLowTemperature": true,
"IncludeHighTemperature": false,
"MustBeFertile": true,
"MustHaveLocalMarket": true,
"MustHaveChamberOfCommerce": false,
"MustHaveWarehouse": true,
"MustHaveAdministrationCenter": true,
"MustHaveShipyard": false,
"DistanceChecks": [
"Katoa",
"Promitor",
"Montem"
]
}
Is your feature request related to a problem? Please describe.
FIO Wrapper currently does not set a timeout for requests towards FIO in case FIO is not responding:
# fio_adapter.py :: _do()
response = requests.request(
method=http_method,
url=endpoint,
verify=self._ssl_verify,
headers=self.headers(),
params=params,
json=data,
)
We should set one / allow setting one as FIO could be unavailable and the wrapper should not block all executions.
Describe the solution you'd like
Additional context
Python requests
can set the timeout
parameter on individual requests, however a Note mentions that this timeout is only related to the request receiving an response:
timeout is not a time limit on the entire response download; rather, an exception is raised if the server has not issued a response for timeout seconds (more precisely, if no bytes have been received on the underlying socket for timeout seconds). If no timeout is specified explicitly, requests do not time out.
Open points
When I call the planet.search() method it doesnt return distances.
locDistance = fio.Planet.search(include_rocky=True, distance_checks=["ANT", "MOR"])
Expected distances from the planets
Is your feature request related to a problem? Please describe.
Currently FIO Wrapper receives minor user input like api_key
when FIO
is instantiated. Things that might change due to a new API Version coming out, like URL endpoints are currently hard-coded in urls.py
.
This should be changed to a configuration file approach where the wrapper brings its own base configuration and the user is allowed to overwrite them.
Examplary .ini base config structure
[FIO]
api_key = 12345
app_name = my wrapped app
[1.0.0.URL]
base = https://rest.fnar.com
material_base = /material
material_allmaterials = /allmaterials
Describe the solution you'd like
FIO Wrapper allows providing a config file on instantiation while keeping the "low effort" capability to just add a FIO API Key and Version number.
base_url
moves into config depends on version
ssl_verification
moves into configapp_name
will be a required attribute either in FIO()
or config , there is a fallback in base config of FIO Wrapper
Is your feature request related to a problem? Please describe.
Currently all requests are executed against FIO endpoints while some of them have data that does not change on repeated execution. FIO has set up Cloudflare caching on their side, nevertheless it would be good to also cache requests from within FIO Wrapper instead of executing them.
Describe the solution you'd like
functools
with lru_cache
(@functools.lru_cache) as decorator.Additional context
Is your feature request related to a problem? Please describe.
Logging functionalities should be provided in fio_wrapper
.
Describe the solution you'd like
Basic _do logging
Describe alternatives you've considered
loguru
structlog
Additional context
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.