Browse Source

Add setup.py and license, moved some files

JoostSijm 4 năm trước cách đây
mục cha
commit
baaed2455a

+ 7 - 0
LICENSE

@@ -0,0 +1,7 @@
+Copyright 2020 SolitudalDeveloper & Joost Sijm
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 31 - 2
README.md

@@ -1,4 +1,33 @@
 # RR-API-Wrapper
-A Python API wrapper for Rival Regions
+This library will functions as an API wrapper for interaction with Rival Regions.
 
-[Link to upstream Discord!](https://discord.gg/6fzHtJM)
+## Middleware
+The API wrapper uses middleware to decide where how to send the request.
+Middlewares can also be used to write direct requests to Rival Regions. 
+
+Current middleware 
+
+## LocalAuthentication 
+Use username, password, and login method to log in localy.
+
+## RemoteAuthentication
+Connect in through remote API using URL and authentication key.
+
+## Examples
+Create local authentication middleman and log in with environ variables.
+
+```python
+import os
+from rival_regions_wrapper import LocalAuthentication
+
+middleware = LocalAuthentication(
+  os.environ["USERNAME"],
+  os.environ["PASSWORD"],
+  os.environ["LOGIN_METHOD"]
+)
+
+region = middleware.get('listed/upgrades/{}'.format(region_id))
+```
+
+### Contact
+* [Discord](https://discord.gg/6fzHtJM)

+ 0 - 0
__init__.py → rival_regions_wrapper/__init__.py


+ 0 - 0
api_wrapper/__init__.py → rival_regions_wrapper/api_wrapper/__init__.py


+ 0 - 0
authentication_handler/authentication_handler.py → rival_regions_wrapper/authentication_handler/authentication_handler.py


+ 0 - 0
middleware/middleware.py → rival_regions_wrapper/middleware/middleware.py


+ 25 - 0
setup.py

@@ -0,0 +1,25 @@
+import setuptools
+
+with open("README.md", "r") as fh:
+    long_description = fh.read()
+
+setuptools.setup(
+    name="rival_regions_wrapper",
+    version="0.1.0",
+    author="Joost Sijm",
+    author_email="joostsijm@gmail.com",
+    description="Rival Regions API wrapper",
+    long_description=long_description,
+    long_description_content_type="text/markdown",
+    url="https://github.com/jjoo914/rival_regions_calc",
+    packages=setuptools.find_packages(),
+    install_requires=[
+       'webbot',
+       'cfscrape'
+    ],
+    classifiers=[
+        "Programming Language :: Python :: 3",
+        "License :: OSI Approved :: Apache Software License",
+        "Operating System :: OS Independent",
+    ],
+)

+ 0 - 40
testing/test_login.py

@@ -1,40 +0,0 @@
-"""Test module"""
-
-from rival_regins_wrapper import Client
-
-
-def main():
-    """Main method"""
-    user = input("User: ")
-    passw = input("Pass: ")
-    method = input("Method: ")
-
-    client = Client(method, user, passw, show_window=True)
-    print(client.var_c)
-
-    action = input("Action: ")
-    action_dict = {
-        "market": market,
-        "article": article
-    }
-
-    if action in action_dict:
-        action_dict[action](client)
-
-def market(client):
-    """Get all market prices"""
-    # print(client.market_info('oil'))
-    market_info = client.get_all_market_info()
-    for i in market_info:
-        print("")
-        print(i.upper())
-        print("#"*len(i))
-        for j in market_info[i]:
-            print(j.upper() + ':' + market_info[i][j])
-
-def article(client):
-    """Create article"""
-    client.create_article("Test", "Whoops")
-
-if __name__ == "__main__":
-    main()