From 891f1fce53fc7ef33764031dc0a595ed1126dea6 Mon Sep 17 00:00:00 2001 From: RyanGamingYT Date: Fri, 12 Jan 2024 20:27:02 +0500 Subject: [PATCH] New Version! (1.2) --- envhub/api.py | 2 +- package/EnvHub.egg-info/PKG-INFO | 12 ++++++- package/EnvHub.egg-info/SOURCES.txt | 6 ++-- package/EnvHub.egg-info/top_level.txt | 2 +- package/build/lib/envhub/api.py | 42 +++++++++++++++++++---- package/dist/EnvHub-1.0-py3-none-any.whl | Bin 1599 -> 0 bytes package/dist/EnvHub-1.0.tar.gz | Bin 1167 -> 0 bytes package/dist/EnvHub-1.1-py3-none-any.whl | Bin 0 -> 1899 bytes package/dist/EnvHub-1.1.tar.gz | Bin 0 -> 1723 bytes 9 files changed, 52 insertions(+), 12 deletions(-) delete mode 100644 package/dist/EnvHub-1.0-py3-none-any.whl delete mode 100644 package/dist/EnvHub-1.0.tar.gz create mode 100644 package/dist/EnvHub-1.1-py3-none-any.whl create mode 100644 package/dist/EnvHub-1.1.tar.gz diff --git a/envhub/api.py b/envhub/api.py index ea8a10d..7302748 100644 --- a/envhub/api.py +++ b/envhub/api.py @@ -24,7 +24,7 @@ def get_var(name: str) -> str: if r.status_code == 200: return r.json()["value"] else: - raise ConnectionError(r.json()) + raise ConnectionError("An error occured with the API. Status Code: " + r.status_code + " Message: " + r.text) def set_var(name: str, value: str) -> str: """ diff --git a/package/EnvHub.egg-info/PKG-INFO b/package/EnvHub.egg-info/PKG-INFO index 0b1fe94..13bba32 100644 --- a/package/EnvHub.egg-info/PKG-INFO +++ b/package/EnvHub.egg-info/PKG-INFO @@ -1,3 +1,13 @@ Metadata-Version: 2.1 Name: EnvHub -Version: 1.0 +Version: 1.1 +Summary: UNKNOWN +Home-page: https://github.com/RyanBaig/EnvHub-Python +Author: RyanBaig +License: UNKNOWN +Description: + # EnvHub Python SDK + ## Hello, This is the **official** Python SDK for [EnvHub](https://envhub.ryanbaig.vercel.app). + +Platform: UNKNOWN +Description-Content-Type: text/markdown diff --git a/package/EnvHub.egg-info/SOURCES.txt b/package/EnvHub.egg-info/SOURCES.txt index 42fca55..4c4b9db 100644 --- a/package/EnvHub.egg-info/SOURCES.txt +++ b/package/EnvHub.egg-info/SOURCES.txt @@ -1,7 +1,7 @@ +LICENSE +README.md setup.py EnvHub.egg-info/PKG-INFO EnvHub.egg-info/SOURCES.txt EnvHub.egg-info/dependency_links.txt -EnvHub.egg-info/top_level.txt -envhub/__init__.py -envhub/api.py \ No newline at end of file +EnvHub.egg-info/top_level.txt \ No newline at end of file diff --git a/package/EnvHub.egg-info/top_level.txt b/package/EnvHub.egg-info/top_level.txt index 51c2f2e..8b13789 100644 --- a/package/EnvHub.egg-info/top_level.txt +++ b/package/EnvHub.egg-info/top_level.txt @@ -1 +1 @@ -envhub + diff --git a/package/build/lib/envhub/api.py b/package/build/lib/envhub/api.py index 96b7443..7302748 100644 --- a/package/build/lib/envhub/api.py +++ b/package/build/lib/envhub/api.py @@ -7,21 +7,51 @@ import requests from requests.exceptions import ConnectionError -def get_var(name): +def get_var(name: str) -> str: """ Retrieves the value of a variable from the EnvHub API. - + Parameters: name (str): The name of the variable to retrieve. - + Returns: str: The value of the variable. - + Raises: ConnectionError: If the API request fails or returns an error. """ - r = requests.get('https://envhub.ryanbaig.vercel.app/api/vars?varName=' + name) + r = requests.get('https://envhub.ryanbaig.vercel.app/api/vars/get?varName=' + name) if r.status_code == 200: return r.json()["value"] else: - raise ConnectionError(r.json()) \ No newline at end of file + raise ConnectionError("An error occured with the API. Status Code: " + r.status_code + " Message: " + r.text) + +def set_var(name: str, value: str) -> str: + """ + Sends a POST request to the 'https://envhub.ryanbaig.vercel.app/api/vars/set' endpoint to set a variable in the environment hub. + + Args: + name (str): The name of the variable. + value (str): The value of the variable. + + Returns: + str: The new value of the variable as returned by the API. + + Raises: + ConnectionError: If there is a connection error or if the API response indicates an error. + """ + + body = { + "varName": name, + "varValue": value, + } + + + r = requests.post('https://envhub.ryanbaig.vercel.app/api/vars/set', json=body) + if r.status_code == 200 and r.json()["statusCode"] == 200: + # I should return what in this scenario? ans: the new value + return r.json() + else: + raise ConnectionError(r.json()) + + \ No newline at end of file diff --git a/package/dist/EnvHub-1.0-py3-none-any.whl b/package/dist/EnvHub-1.0-py3-none-any.whl deleted file mode 100644 index 781a839bd079f1fd3f84f65c971a2ecb086cf676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1599 zcmWIWW@Zs#U|`^2aBOT0&wTc92Z$#G#i@B^8Kp`3@$s2?nI-Y@dIgo<+NaKkUhvjA z5pv>;?g@RZzza+a0dO;Vfo4QIom`vA$iVP}iGhI^Xb#kj#DYwq_PG-ry$?GGw7zfr z)2=vu8As+v2@a*8jpCY@W_!$BHaSi8Ztv#VEB@cRnG@{1cW1kS@Uy)?pQ(BZx!;b8 zToK|NAoVsN^QBd+RqB$YtP2+z=P)jnH9S>c+v5K;tHAW2*LVNBa_`Jv>-0T(Q7H1P zkmXa~lQP?)RUchG%fy}7xM<#+1#dUL1$3 zzP6hi&%Ri_#LQv7x_r+ylLu>N@K*0*4h{EdERJ~4{a=XfD_f+G>ave@|NqE&tWD-j z(B8FB{QQOoZ?t}Xs{DG?H^S;#u(lzmocM;7C)W#1UApp}R;SE0N6k0M4FLKlu@HvJx04J>Pn(4S;cB3dFKN?3!2RQJSP{sAr&;l384$o0*rEukY&`;^^WS z;`rHD*VD&S$MXuWx31Q?Gv_x48C)`c^7NDU8Q-lz1!uKCYxq8T+H_j-mE?z_k420~ z(GRl9bCKfd7@!p(EQQOea1U2kAMW!WzGp8YEV*L*pveEMx2~7YN&QVh9$qJP^g8v~ zR|Z}%xL|B}!T7=xu2bjrFMidz#;c+0b@rssrXUSXE#IeHo<7@yG**~gJA3-P_f_9B ztDihVPLeBtZW0Z$kmdxsg&l~MaJi`@zaTy*wJbG9ucV^H`>gh9pf`~X0(nkX;d8ep zFm0~{Vrg6k1-Ux=2f5^)@h)lthWUlP>6{#a96Gx=m*I!1zRY-oEZW zO3@f8t$tG^Y?R-N}Lz0Q9- zjgfQD;wc=_tR1Ix{&p{#_0PJ%RP|Zz^7Sz-bEH#JmmD^`ThDvC>BNNCU%Kyd>@R(} z$L1lHmS!4Jd!}>G0rfBU3b&lPamTR##sT*~Ugg)lBHl?=RvCFG~g~r{>n~Dthgi?~@*AB=7l=RjcL4Io6k358ZXo zjc54s&vwQxV3M5imnp!Tkx7IBcNqi>W-!>+2%<1cBxL>A${&bs28L~oE(raQ(g;~A zwrqmXdIK2Ycry*UQRvwKVU#nlT*PV=I8z{-gDvSI%(;%s9F&BNY#z203^Q*_qXIJy YcR|u~fHx}}NHH4_E(eB26AOq30F|mn%m4rY diff --git a/package/dist/EnvHub-1.0.tar.gz b/package/dist/EnvHub-1.0.tar.gz deleted file mode 100644 index 55f39604371d37710095c3d4c1918e5688830e4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1167 zcmV;A1aSKwiwFoE25Myj|3z+gNOfW@F)lDJbYXG;?OR=M+cp&SvjP7H!Y{G6M%K47 z1I9KK=^6}egSOjCF$lCp+gxQzqi8Sr_oXB|ab+h(220zba~>R$;>Q)kd(Y)1WsHo` zPuKM3HKP%eomya)c<8TbI_`ZsFSjh$vpeLb(*V|)qEZik>X-bVz`h_W#aC=%1*YY? zf%QXR1cC3l?nSo)JbPS<&Fl5_+%n8jZDZv65Cp-)`d>|3rXRQ+;z9pwhXMN!`(L&H zp5?iY1N+}D`(Gvvwpg5VF;7M()&Hm2f5-DY*#Fkpf7?H_{|@YbBlh1uwEre7KkR=p zy8iW-^Q*V7-kn7Mecyjr|9z*T|E}*@9b!WNYsVX=Xhan~|DDNA^TWCxHLK|KNY{{}KNG@b0(wFE2kB>PFSe|F&yY^xtzGAN=10GN#t4 zk=}M6^8UJyEQ^C@5lfkfn3&y$F&Ce+qm@*WhB4c)xOmFMX1Sh@!jKED!Y~(QTSQZ? zb5K$6KlC5`4>ZmH$BcPB`+u{_|AB8i;QuB7RR{lr|H1#@fAIff`?Nau|E3vK^xt<( z7yRD@%Dpxe9{i8{U#;Z-qxXMZPbXm%+Qt7TJMVuo{~w(HTR~ug|C<2L|H1#@fAIfT z{O<>v|8f7jW&FQAcCAPMpLYM-wzNxt``>M`|A_zod-lH)|J7uS_;0K2|K3fUruKif zUA_Np`?&wr2<9?b5rd|j@Ku^fMZSYhVE+gHZ!7;>t`GiiHUFRf+U+;^-*SS3?|&UL z0RK0Ee!t)Aeq8d5%z4bnED?%wp>u07Q#{cr$zrNlL{vh!P)t%?E*9i(u9ieC*)~W_ ze!jjkdfi_4)vn>V*CiSYros)C13_18I419zlALW=R4K0k*yB`IXzD?|Rd+tfkoRN_SHBaVOY*C-)60 z&)9yu%1n&ORoPO@zMDWYr##L`B6B(NVF?w4<+Y8<6iG6hIQCTHaPVkU-Vr+iMNp_Ngsvv8I~j7%oPHqE_v zD8&0F7=G#(bI|{ztij@p?N`ocp!(W_UE3in|9{B;bDTr}&w~Hgi2oNHJO97% zTn|oQ%lyCcQ?S{5QHTCN8vpUC@gLi>Z1{go;1gRc!u-0YW>G~K;dIU8NYi_ni?rvb zGiL5qKv%&3i2pqE_>b>8CgMMB=KmVLxc=t%{|Ddy*-n7?Pa`N|8O48IB}sf2I4MeA zkU1Aon9|v2x?oxE1Qg|ia+fWNO?YvInN diff --git a/package/dist/EnvHub-1.1-py3-none-any.whl b/package/dist/EnvHub-1.1-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..6cebe54325e121977ffeb7e8d0b3a86df1919efb GIT binary patch literal 1899 zcmWIWW@Zs#U|`^2kgV2;FswM;U(Uq9pv}U-AOjS2%`5XLP0}^gGt^7TEH2T_%uCDH z_wjUg^$T{54f4*vZNRhdb+~|SX~RX{ySe5^!=w`H9K&X@9_H)QJuW4qz2OP#-|xzE zx5Tou7`S|@o_KOe+ZD64FKrud%#By8e#3mneEx%vryqy^xOw)l!8P^I-5W3YsK4G@ zsvN<;cjlRgtbM_@Y?s|G_#SI`z2N2Rml;Y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